From 914887ff78aaa61ed59de9f46e54ac058a9cd0f0 Mon Sep 17 00:00:00 2001 From: Ahtisham Shahid Date: Mon, 8 Sep 2025 19:33:33 +0500 Subject: [PATCH] Revert "feat: added api for mobile configs (#37323)" (#37332) This reverts commit 3d4652420c1deb3873eea1cd995903e385f692a5. --- lms/djangoapps/mobile_api/tests/test_views.py | 54 ------------------- lms/djangoapps/mobile_api/urls.py | 3 +- lms/djangoapps/mobile_api/views.py | 20 ------- 3 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 lms/djangoapps/mobile_api/tests/test_views.py delete mode 100644 lms/djangoapps/mobile_api/views.py diff --git a/lms/djangoapps/mobile_api/tests/test_views.py b/lms/djangoapps/mobile_api/tests/test_views.py deleted file mode 100644 index ea0f12cc94..0000000000 --- a/lms/djangoapps/mobile_api/tests/test_views.py +++ /dev/null @@ -1,54 +0,0 @@ -""" -Unit tests for MobileConfigurationView API endpoint. -""" -from django.urls import reverse -from rest_framework import status -from rest_framework.test import APITestCase - -from lms.djangoapps.mobile_api.models import MobileConfig - - -class MobileConfigurationViewTest(APITestCase): - """ - Test cases for MobileConfigurationView API endpoint. - """ - - def setUp(self): - """ - Set up test data and common test utilities. - """ - self.url = reverse('mobile-configurations', kwargs={'api_version': 'v1'}) - - def test_get_mobile_configurations_empty_database(self): - """ - Test API response when no configurations exist in database. - """ - # Act - response = self.client.get(self.url) - - # Assert - self.assertEqual(response.status_code, status.HTTP_200_OK) - expected_data = {"iap_configs": {}} - self.assertEqual(response.data, expected_data) - - def test_get_mobile_configurations_with_regular_configs(self): - """ - Test API response with regular (non-IAP) configurations. - """ - # Arrange - MobileConfig.objects.create(name='app_version', value='2.1.0') - MobileConfig.objects.create(name='enable_dark_mode', value='true') - MobileConfig.objects.create(name='api_timeout', value='30') - - # Act - response = self.client.get(self.url) - - # Assert - self.assertEqual(response.status_code, status.HTTP_200_OK) - expected_data = { - "iap_configs": {}, - "app_version": "2.1.0", - "enable_dark_mode": "true", - "api_timeout": "30" - } - self.assertEqual(response.data, expected_data) diff --git a/lms/djangoapps/mobile_api/urls.py b/lms/djangoapps/mobile_api/urls.py index c7c6891bd5..c7aacc0b66 100644 --- a/lms/djangoapps/mobile_api/urls.py +++ b/lms/djangoapps/mobile_api/urls.py @@ -2,15 +2,14 @@ URLs for mobile API """ + from django.urls import include, path from .users.views import my_user_info -from .views import MobileConfigurationView urlpatterns = [ path('users/', include('lms.djangoapps.mobile_api.users.urls')), path('my_user_info', my_user_info, name='user-info'), path('notifications/', include('lms.djangoapps.mobile_api.notifications.urls')), path('course_info/', include('lms.djangoapps.mobile_api.course_info.urls')), - path('configurations/', MobileConfigurationView.as_view(), name='mobile-configurations') ] diff --git a/lms/djangoapps/mobile_api/views.py b/lms/djangoapps/mobile_api/views.py deleted file mode 100644 index 5da0bc959a..0000000000 --- a/lms/djangoapps/mobile_api/views.py +++ /dev/null @@ -1,20 +0,0 @@ -""" -Views for the mobile API. -""" - -from rest_framework.response import Response -from rest_framework.views import APIView - -from lms.djangoapps.mobile_api.models import MobileConfig - - -class MobileConfigurationView(APIView): - """ - API endpoint that returns mobile configuration data. - """ - - def get(self, request, *args, **kwargs): - """ - Get all mobile configurations. - """ - return Response(MobileConfig.get_structured_configs())