Skip to content

Commit

Permalink
fix: update tests to work with the new course authoring setting
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-i-am committed Feb 28, 2024
1 parent 32d9485 commit 2910562
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):

Expand Down
10 changes: 9 additions & 1 deletion cms/lib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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",
default_value = True if DISABLE_COURSE_AUTHORING_MFE_TOGGLE else False
)

return bool(use_course_authoring_legacy)

0 comments on commit 2910562

Please sign in to comment.