fix: look up ENABLE_CATALOG_MICROFRONTEND in settings directly, adjust tests

This commit is contained in:
Serhii Nanai
2025-09-29 14:15:57 +03:00
parent 94c00afa65
commit b448b0fe69
9 changed files with 4 additions and 18 deletions

View File

@@ -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.

View File

@@ -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.

View File

@@ -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

View File

@@ -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

View File

@@ -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.

View File

@@ -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,

View File

@@ -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

View File

@@ -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
)

View File

@@ -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