From b448b0fe69982e093f84b0d8af8c54718d963a08 Mon Sep 17 00:00:00 2001 From: Serhii Nanai Date: Mon, 29 Sep 2025 14:15:57 +0300 Subject: [PATCH] fix: look up ENABLE_CATALOG_MICROFRONTEND in settings directly, adjust tests --- .../contentstore/rest_api/v1/views/tests/test_settings.py | 1 - cms/djangoapps/contentstore/tests/test_contentstore.py | 2 -- cms/djangoapps/contentstore/tests/test_course_settings.py | 3 --- .../contentstore/views/tests/test_credit_eligibility.py | 1 - .../contentstore/views/tests/test_exam_settings_view.py | 1 - common/djangoapps/student/tests/test_views.py | 1 - common/djangoapps/util/tests/test_course.py | 4 +--- lms/djangoapps/branding/toggles.py | 2 +- lms/djangoapps/learner_home/test_views.py | 7 ++----- 9 files changed, 4 insertions(+), 18 deletions(-) diff --git a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_settings.py b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_settings.py index 81101e541b..15b0992fdf 100644 --- a/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_settings.py +++ b/cms/djangoapps/contentstore/rest_api/v1/views/tests/test_settings.py @@ -17,7 +17,6 @@ from ...mixins import PermissionAccessMixin @ddt.ddt -@patch.dict("django.conf.settings.FEATURES", {"ENABLE_CATALOG_MICROFRONTEND": False}) class CourseSettingsViewTest(CourseTestCase, PermissionAccessMixin): """ Tests for CourseSettingsView. diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py index 4380c1e938..8b6aa6d2bb 100644 --- a/cms/djangoapps/contentstore/tests/test_contentstore.py +++ b/cms/djangoapps/contentstore/tests/test_contentstore.py @@ -91,7 +91,6 @@ def requires_pillow_jpeg(func): @override_settings(CONTENTSTORE=TEST_DATA_CONTENTSTORE) -@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_CATALOG_MICROFRONTEND": False}) class ContentStoreTestCase(CourseTestCase): """ Base class for Content Store Test Cases @@ -1050,7 +1049,6 @@ class MiscCourseTests(ContentStoreTestCase): @ddt.ddt -@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_CATALOG_MICROFRONTEND": False}) class ContentStoreTest(ContentStoreTestCase): """ Tests for the CMS ContentStore application. diff --git a/cms/djangoapps/contentstore/tests/test_course_settings.py b/cms/djangoapps/contentstore/tests/test_course_settings.py index 197e55a6da..08d858c550 100644 --- a/cms/djangoapps/contentstore/tests/test_course_settings.py +++ b/cms/djangoapps/contentstore/tests/test_course_settings.py @@ -182,7 +182,6 @@ class CourseAdvanceSettingViewTest(CourseTestCase, MilestonesTestCaseMixin): with override_settings(FEATURES={ 'DISABLE_ADVANCED_SETTINGS': disable_advanced_settings, - 'ENABLE_CATALOG_MICROFRONTEND': False, }): for handler in ( 'import_handler', @@ -222,7 +221,6 @@ class CourseAdvanceSettingViewTest(CourseTestCase, MilestonesTestCaseMixin): @ddt.ddt -@patch.dict("django.conf.settings.FEATURES", {"ENABLE_CATALOG_MICROFRONTEND": False}) class CourseDetailsViewTest(CourseTestCase, MilestonesTestCaseMixin): """ Tests for modifying content on the first course settings page (course dates, overview, etc.). @@ -1927,7 +1925,6 @@ class CourseGraderUpdatesTest(CourseTestCase): self.assertEqual(len(self.starting_graders) + 1, len(current_graders)) -@patch.dict("django.conf.settings.FEATURES", {"ENABLE_CATALOG_MICROFRONTEND": False}) class CourseEnrollmentEndFieldTest(CourseTestCase): """ Base class to test the enrollment end fields in the course settings details view in Studio diff --git a/cms/djangoapps/contentstore/views/tests/test_credit_eligibility.py b/cms/djangoapps/contentstore/views/tests/test_credit_eligibility.py index a16ccb0762..66e42598be 100644 --- a/cms/djangoapps/contentstore/views/tests/test_credit_eligibility.py +++ b/cms/djangoapps/contentstore/views/tests/test_credit_eligibility.py @@ -15,7 +15,6 @@ from openedx.core.djangoapps.credit.signals.handlers import on_course_publish from xmodule.modulestore.tests.factories import CourseFactory # lint-amnesty, pylint: disable=wrong-import-order -@mock.patch.dict("django.conf.settings.FEATURES", {"ENABLE_CATALOG_MICROFRONTEND": False}) class CreditEligibilityTest(CourseTestCase): """ Base class to test the course settings details view in Studio for credit diff --git a/cms/djangoapps/contentstore/views/tests/test_exam_settings_view.py b/cms/djangoapps/contentstore/views/tests/test_exam_settings_view.py index 1684be98f5..9bad2c77fc 100644 --- a/cms/djangoapps/contentstore/views/tests/test_exam_settings_view.py +++ b/cms/djangoapps/contentstore/views/tests/test_exam_settings_view.py @@ -30,7 +30,6 @@ from common.djangoapps.util.testing import UrlResetMixin @override_waffle_flag(toggles.LEGACY_STUDIO_CONFIGURATIONS, True) @override_waffle_flag(toggles.LEGACY_STUDIO_GRADING, True) @override_waffle_flag(toggles.LEGACY_STUDIO_ADVANCED_SETTINGS, True) -@patch.dict("django.conf.settings.FEATURES", {"ENABLE_CATALOG_MICROFRONTEND": False}) class TestExamSettingsView(CourseTestCase, UrlResetMixin): """ Unit tests for the exam settings view. diff --git a/common/djangoapps/student/tests/test_views.py b/common/djangoapps/student/tests/test_views.py index 0fce8d0f03..b63c522bbd 100644 --- a/common/djangoapps/student/tests/test_views.py +++ b/common/djangoapps/student/tests/test_views.py @@ -191,7 +191,6 @@ class StudentDashboardTests(SharedModuleStoreTestCase, MilestonesTestCaseMixin, 'DISABLE_START_DATES': False, 'ENABLE_MKTG_SITE': True, 'DISABLE_SET_JWT_COOKIES_FOR_TESTS': True, - 'ENABLE_CATALOG_MICROFRONTEND': False, }, 'SOCIAL_SHARING_SETTINGS': { 'CUSTOM_COURSE_URLS': True, diff --git a/common/djangoapps/util/tests/test_course.py b/common/djangoapps/util/tests/test_course.py index fb3a61d966..a4fd4de595 100644 --- a/common/djangoapps/util/tests/test_course.py +++ b/common/djangoapps/util/tests/test_course.py @@ -146,8 +146,6 @@ class TestCourseSharingLinks(ModuleStoreTestCase): """ Verify the method gives correct course sharing url when new course about page is used. """ - features = settings.FEATURES.copy() - features['ENABLE_CATALOG_MICROFRONTEND'] = catalog_mfe_enabled - with override_settings(FEATURES=features): + with override_settings(ENABLE_CATALOG_MICROFRONTEND=catalog_mfe_enabled): actual_course_sharing_link = get_link_for_about_page(self.course_overview) assert actual_course_sharing_link == expected_course_sharing_link diff --git a/lms/djangoapps/branding/toggles.py b/lms/djangoapps/branding/toggles.py index 9612843f0e..a69afb9f14 100644 --- a/lms/djangoapps/branding/toggles.py +++ b/lms/djangoapps/branding/toggles.py @@ -11,5 +11,5 @@ def use_catalog_mfe(): Returns a boolean = true if the Catalog MFE is enabled. """ return configuration_helpers.get_value( - 'ENABLE_CATALOG_MICROFRONTEND', settings.FEATURES.get('ENABLE_CATALOG_MICROFRONTEND') + 'ENABLE_CATALOG_MICROFRONTEND', settings.ENABLE_CATALOG_MICROFRONTEND ) diff --git a/lms/djangoapps/learner_home/test_views.py b/lms/djangoapps/learner_home/test_views.py index ddb22a91da..8722629371 100644 --- a/lms/djangoapps/learner_home/test_views.py +++ b/lms/djangoapps/learner_home/test_views.py @@ -98,11 +98,8 @@ class TestGetPlatformSettings(TestCase): """ Test that the catalog link is constructed correctly based on the MFE flags. """ - features = settings.FEATURES.copy() - features['ENABLE_CATALOG_MICROFRONTEND'] = catalog_mfe_enabled - with override_settings(FEATURES=features): - actual_course_sharing_link = get_platform_settings()["courseSearchUrl"] - assert actual_course_sharing_link == expected_catalog_link + with override_settings(ENABLE_CATALOG_MICROFRONTEND=catalog_mfe_enabled): + assert get_platform_settings()["courseSearchUrl"] == expected_catalog_link @ddt.ddt