From 276b035e01ff4098d7fc97307b3dfeb937fbd5bc Mon Sep 17 00:00:00 2001 From: bra-i-am Date: Wed, 28 Feb 2024 14:13:45 -0500 Subject: [PATCH] fix: update tests to work with the new course authoring setting --- .../contentstore/views/tests/test_course_index.py | 5 ++++- .../views/tests/test_exam_settings_view.py | 6 +++++- cms/lib/utils.py | 10 +++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/views/tests/test_course_index.py b/cms/djangoapps/contentstore/views/tests/test_course_index.py index 9fdbb425e51..aafea395dc4 100644 --- a/cms/djangoapps/contentstore/views/tests/test_course_index.py +++ b/cms/djangoapps/contentstore/views/tests/test_course_index.py @@ -643,7 +643,10 @@ def test_verify_warn_only_on_enabled_blocks(self, enabled_block_types, deprecate expected_block_types ) - @override_settings(FEATURES={'ENABLE_EXAM_SETTINGS_HTML_VIEW': True}) + @override_settings(FEATURES={ + 'ENABLE_EXAM_SETTINGS_HTML_VIEW': True, + 'DISABLE_COURSE_AUTHORING_MFE_TOGGLE': True + }) @patch('cms.djangoapps.models.settings.course_metadata.CourseMetadata.validate_proctoring_settings') def test_proctoring_link_is_visible(self, mock_validate_proctoring_settings): """ 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 a7ee7f0ab0c..c62a90ee9c8 100644 --- a/cms/djangoapps/contentstore/views/tests/test_exam_settings_view.py +++ b/cms/djangoapps/contentstore/views/tests/test_exam_settings_view.py @@ -19,6 +19,7 @@ FEATURES_WITH_EXAM_SETTINGS_ENABLED = FEATURES_WITH_CERTS_ENABLED.copy() FEATURES_WITH_EXAM_SETTINGS_ENABLED['ENABLE_EXAM_SETTINGS_HTML_VIEW'] = True FEATURES_WITH_EXAM_SETTINGS_ENABLED['ENABLE_PROCTORED_EXAMS'] = True +FEATURES_WITH_EXAM_SETTINGS_ENABLED['DISABLE_COURSE_AUTHORING_MFE_TOGGLE'] = True FEATURES_WITH_EXAM_SETTINGS_DISABLED = FEATURES_WITH_CERTS_ENABLED.copy() FEATURES_WITH_EXAM_SETTINGS_DISABLED['ENABLE_EXAM_SETTINGS_HTML_VIEW'] = False @@ -179,7 +180,10 @@ def test_exam_settings_alert_not_shown(self, page_handler): alert_nodes = parsed_html.find_class('exam-settings-alert') assert len(alert_nodes) == 0 - @override_settings(FEATURES={'ENABLE_EXAM_SETTINGS_HTML_VIEW': True}) + @override_settings(FEATURES={ + 'ENABLE_EXAM_SETTINGS_HTML_VIEW': True, + 'DISABLE_COURSE_AUTHORING_MFE_TOGGLE': True + }) @patch('cms.djangoapps.models.settings.course_metadata.CourseMetadata.validate_proctoring_settings') def test_proctoring_link_is_visible(self, mock_validate_proctoring_settings): diff --git a/cms/lib/utils.py b/cms/lib/utils.py index cabd7d6325f..aece0dbac69 100644 --- a/cms/lib/utils.py +++ b/cms/lib/utils.py @@ -3,6 +3,7 @@ """ from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers +from edx_toggles.toggles import SettingDictToggle def use_course_authoring_mfe(org) -> bool: @@ -13,8 +14,15 @@ def use_course_authoring_mfe(org) -> bool: True if the MFE setting is activated, by default the MFE is deactivated """ + + DISABLE_COURSE_AUTHORING_MFE_TOGGLE = SettingDictToggle( + "FEATURES", "DISABLE_COURSE_AUTHORING_MFE_TOGGLE", default=False, module_name=__name__ + ).is_enabled() + use_course_authoring_legacy = configuration_helpers.get_value_for_org( - org, "ENABLE_COURSE_AUTHORING_MFE", False + org, + "ENABLE_COURSE_AUTHORING_MFE", + DISABLE_COURSE_AUTHORING_MFE_TOGGLE or False ) return bool(use_course_authoring_legacy)