Use new ENABLE_PUBLISHER feature flag
ENABLE_MKTG_SITE has been serving double duty to both indicate that an Open edX installation is using a Drupal marketing site AND is using the Publisher workflow tool for managing course metadata. But now that publisher-frontend is available and the Publisher feature is no longer tied to the marketing site, we want to tease apart those two concerns. Hence ENABLE_PUBLISHER. Only really used so far in Studio, to control which fields are shown (if using Publisher, some fields are only editable in Publisher).
This commit is contained in:
@@ -240,15 +240,14 @@ class CourseDetailsViewTest(CourseTestCase, MilestonesTestCaseMixin):
|
||||
(False, True, False),
|
||||
(True, True, True),
|
||||
)
|
||||
@override_settings(MKTG_URLS={'ROOT': 'dummy-root'})
|
||||
def test_visibility_of_entrance_exam_section(self, feature_flags):
|
||||
"""
|
||||
Tests entrance exam section is available if ENTRANCE_EXAMS feature is enabled no matter any other
|
||||
feature is enabled or disabled i.e ENABLE_MKTG_SITE.
|
||||
feature is enabled or disabled i.e ENABLE_PUBLISHER.
|
||||
"""
|
||||
with patch.dict("django.conf.settings.FEATURES", {
|
||||
'ENTRANCE_EXAMS': feature_flags[0],
|
||||
'ENABLE_MKTG_SITE': feature_flags[1]
|
||||
'ENABLE_PUBLISHER': feature_flags[1]
|
||||
}):
|
||||
course_details_url = get_url(self.course.id)
|
||||
resp = self.client.get_html(course_details_url)
|
||||
@@ -257,12 +256,11 @@ class CourseDetailsViewTest(CourseTestCase, MilestonesTestCaseMixin):
|
||||
b'<h3 id="heading-entrance-exam">' in resp.content
|
||||
)
|
||||
|
||||
@override_settings(MKTG_URLS={'ROOT': 'dummy-root'})
|
||||
def test_marketing_site_fetch(self):
|
||||
settings_details_url = get_url(self.course.id)
|
||||
|
||||
with mock.patch.dict('django.conf.settings.FEATURES', {
|
||||
'ENABLE_MKTG_SITE': True,
|
||||
'ENABLE_PUBLISHER': True,
|
||||
'ENTRANCE_EXAMS': False,
|
||||
'ENABLE_PREREQUISITE_COURSES': False
|
||||
}):
|
||||
@@ -416,7 +414,7 @@ class CourseDetailsViewTest(CourseTestCase, MilestonesTestCaseMixin):
|
||||
def test_regular_site_fetch(self):
|
||||
settings_details_url = get_url(self.course.id)
|
||||
|
||||
with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_MKTG_SITE': False,
|
||||
with mock.patch.dict('django.conf.settings.FEATURES', {'ENABLE_PUBLISHER': False,
|
||||
'ENABLE_EXTENDED_COURSE_DETAILS': True}):
|
||||
response = self.client.get_html(settings_details_url)
|
||||
self.assertContains(response, "Course Summary Page")
|
||||
@@ -1534,44 +1532,42 @@ id=\"course-enrollment-end-time\" value=\"\" placeholder=\"HH:MM\" autocomplete=
|
||||
for element in self.EDITABLE_ELEMENTS:
|
||||
self.assertNotContains(response, element)
|
||||
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_MKTG_SITE': False})
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_PUBLISHER': False})
|
||||
def test_course_details_with_disabled_setting_global_staff(self):
|
||||
"""
|
||||
Test that user enrollment end date is editable in response.
|
||||
|
||||
Feature flag 'ENABLE_MKTG_SITE' is not enabled.
|
||||
Feature flag 'ENABLE_PUBLISHER' is not enabled.
|
||||
User is global staff.
|
||||
"""
|
||||
self._verify_editable(self._get_course_details_response(True))
|
||||
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_MKTG_SITE': False})
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_PUBLISHER': False})
|
||||
def test_course_details_with_disabled_setting_non_global_staff(self):
|
||||
"""
|
||||
Test that user enrollment end date is editable in response.
|
||||
|
||||
Feature flag 'ENABLE_MKTG_SITE' is not enabled.
|
||||
Feature flag 'ENABLE_PUBLISHER' is not enabled.
|
||||
User is non-global staff.
|
||||
"""
|
||||
self._verify_editable(self._get_course_details_response(False))
|
||||
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_MKTG_SITE': True})
|
||||
@override_settings(MKTG_URLS={'ROOT': 'dummy-root'})
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_PUBLISHER': True})
|
||||
def test_course_details_with_enabled_setting_global_staff(self):
|
||||
"""
|
||||
Test that user enrollment end date is editable in response.
|
||||
|
||||
Feature flag 'ENABLE_MKTG_SITE' is enabled.
|
||||
Feature flag 'ENABLE_PUBLISHER' is enabled.
|
||||
User is global staff.
|
||||
"""
|
||||
self._verify_editable(self._get_course_details_response(True))
|
||||
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_MKTG_SITE': True})
|
||||
@override_settings(MKTG_URLS={'ROOT': 'dummy-root'})
|
||||
@mock.patch.dict("django.conf.settings.FEATURES", {'ENABLE_PUBLISHER': True})
|
||||
def test_course_details_with_enabled_setting_non_global_staff(self):
|
||||
"""
|
||||
Test that user enrollment end date is not editable in response.
|
||||
|
||||
Feature flag 'ENABLE_MKTG_SITE' is enabled.
|
||||
Feature flag 'ENABLE_PUBLISHER' is enabled.
|
||||
User is non-global staff.
|
||||
"""
|
||||
self._verify_not_editable(self._get_course_details_response(False))
|
||||
|
||||
Reference in New Issue
Block a user