diff --git a/openedx/core/djangoapps/mfe_api/tests/test_views.py b/openedx/core/djangoapps/mfe_api/tests/test_views.py new file mode 100644 index 000000000000..b9a286618145 --- /dev/null +++ b/openedx/core/djangoapps/mfe_api/tests/test_views.py @@ -0,0 +1,27 @@ +""" +Test the MFE API +""" + +from unittest.mock import patch + +from django.conf import settings +from django.urls import reverse + +from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers +from openedx.core.lib.api.test_utils import ApiTestCase + + +class MFEConfigTestCase(ApiTestCase): + """ + Test the MFE API + """ + @patch.dict(settings.FEATURES, {'ENABLE_MFE_CONFIG_API': True}) + def setUp(self): + self.mfe_config_api_url = reverse('mfe_config_api') + return super().setUp() + + def test_get_mfe_config(self): + """Test the get mfe config from MFE API.""" + mfe_config = configuration_helpers.get_value('MFE_CONFIG',{}) + response_json = self.get_json(self.mfe_config_api_url) + assert response_json == mfe_config diff --git a/openedx/core/djangoapps/mfe_api/urls.py b/openedx/core/djangoapps/mfe_api/urls.py index 6763594c1dec..129821f019f3 100644 --- a/openedx/core/djangoapps/mfe_api/urls.py +++ b/openedx/core/djangoapps/mfe_api/urls.py @@ -1,11 +1,9 @@ """ URL configuration for the mfe API """ - -from django.conf import settings -from django.urls import path, re_path +from django.urls import re_path from openedx.core.djangoapps.mfe_api.views import MFEConfigView urlpatterns = [ - re_path(fr'^v1/config', MFEConfigView.as_view(), name='mfe_config_api',) + re_path(r'^v1/config', MFEConfigView.as_view(), name='mfe_config_api',) ] diff --git a/openedx/core/djangoapps/mfe_api/views.py b/openedx/core/djangoapps/mfe_api/views.py index c046bb2c509a..b907effe6065 100644 --- a/openedx/core/djangoapps/mfe_api/views.py +++ b/openedx/core/djangoapps/mfe_api/views.py @@ -1,3 +1,7 @@ +""" +MFE API Views. +""" + from django.conf import settings from django.utils.decorators import method_decorator from django.views.decorators.cache import cache_page