Commit cfbf317b by Tim Babych

Merge pull request #4267 from edx/tim/feature-group-configurations

BLD-1217: Create feature flag for switching Group Configurations editing on and off
parents d38b51cb a153092c
...@@ -6,8 +6,10 @@ import ddt ...@@ -6,8 +6,10 @@ import ddt
from mock import patch from mock import patch
from pytz import UTC from pytz import UTC
from unittest import skipUnless
from webob import Response from webob import Response
from django.conf import settings
from django.http import Http404 from django.http import Http404
from django.test import TestCase from django.test import TestCase
from django.test.client import RequestFactory from django.test.client import RequestFactory
...@@ -773,6 +775,7 @@ class TestEditItem(ItemTest): ...@@ -773,6 +775,7 @@ class TestEditItem(ItemTest):
self.verify_publish_state(html_usage_key, PublishState.draft) self.verify_publish_state(html_usage_key, PublishState.draft)
@skipUnless(settings.FEATURES.get('ENABLE_GROUP_CONFIGURATIONS'), 'Tests Group Configurations feature')
class TestEditSplitModule(ItemTest): class TestEditSplitModule(ItemTest):
""" """
Tests around editing instances of the split_test module. Tests around editing instances of the split_test module.
......
...@@ -25,6 +25,7 @@ Longer TODO: ...@@ -25,6 +25,7 @@ Longer TODO:
# pylint: disable=W0401, W0611, W0614 # pylint: disable=W0401, W0611, W0614
import imp import imp
import os
import sys import sys
import lms.envs.common import lms.envs.common
# Although this module itself may not use these imported variables, other dependent modules may. # Although this module itself may not use these imported variables, other dependent modules may.
...@@ -101,6 +102,9 @@ FEATURES = { ...@@ -101,6 +102,9 @@ FEATURES = {
# Turn off Advanced Security by default # Turn off Advanced Security by default
'ADVANCED_SECURITY': False, 'ADVANCED_SECURITY': False,
# Toggles Group Configuration editing functionality
'ENABLE_GROUP_CONFIGURATIONS': os.environ.get('FEATURE_GROUP_CONFIGURATIONS'),
} }
ENABLE_JASMINE = False ENABLE_JASMINE = False
......
...@@ -309,7 +309,6 @@ require(["domReady!", "jquery", "js/models/settings/course_details", "js/views/s ...@@ -309,7 +309,6 @@ require(["domReady!", "jquery", "js/models/settings/course_details", "js/views/s
course_team_url = utils.reverse_course_url('course_team_handler', context_course.id) course_team_url = utils.reverse_course_url('course_team_handler', context_course.id)
grading_config_url = utils.reverse_course_url('grading_handler', context_course.id) grading_config_url = utils.reverse_course_url('grading_handler', context_course.id)
advanced_config_url = utils.reverse_course_url('advanced_settings_handler', context_course.id) advanced_config_url = utils.reverse_course_url('advanced_settings_handler', context_course.id)
group_configurations_config_url = utils.reverse_course_url('group_configurations_list_handler', context_course.id)
%> %>
<h3 class="title-3">${_("Other Course Settings")}</h3> <h3 class="title-3">${_("Other Course Settings")}</h3>
<nav class="nav-related"> <nav class="nav-related">
...@@ -318,7 +317,7 @@ require(["domReady!", "jquery", "js/models/settings/course_details", "js/views/s ...@@ -318,7 +317,7 @@ require(["domReady!", "jquery", "js/models/settings/course_details", "js/views/s
<li class="nav-item"><a href="${course_team_url}">${_("Course Team")}</a></li> <li class="nav-item"><a href="${course_team_url}">${_("Course Team")}</a></li>
<li class="nav-item"><a href="${advanced_config_url}">${_("Advanced Settings")}</a></li> <li class="nav-item"><a href="${advanced_config_url}">${_("Advanced Settings")}</a></li>
% if "split_test" in context_course.advanced_modules: % if "split_test" in context_course.advanced_modules:
<li class="nav-item"><a href="${group_configurations_config_url}">${_("Group Configurations")}</a></li> <li class="nav-item"><a href="${utils.reverse_course_url('group_configurations_list_handler', context_course.id)}">${_("Group Configurations")}</a></li>
% endif % endif
</ul> </ul>
</nav> </nav>
......
...@@ -118,7 +118,6 @@ require(["domReady!", "jquery", "gettext", "js/models/settings/advanced", "js/vi ...@@ -118,7 +118,6 @@ require(["domReady!", "jquery", "gettext", "js/models/settings/advanced", "js/vi
details_url = utils.reverse_course_url('settings_handler', context_course.id) details_url = utils.reverse_course_url('settings_handler', context_course.id)
grading_url = utils.reverse_course_url('grading_handler', context_course.id) grading_url = utils.reverse_course_url('grading_handler', context_course.id)
course_team_url = utils.reverse_course_url('course_team_handler', context_course.id) course_team_url = utils.reverse_course_url('course_team_handler', context_course.id)
group_configurations_config_url = utils.reverse_course_url('group_configurations_list_handler', context_course.id)
%> %>
<h3 class="title-3">${_("Other Course Settings")}</h3> <h3 class="title-3">${_("Other Course Settings")}</h3>
<nav class="nav-related"> <nav class="nav-related">
...@@ -126,8 +125,8 @@ require(["domReady!", "jquery", "gettext", "js/models/settings/advanced", "js/vi ...@@ -126,8 +125,8 @@ require(["domReady!", "jquery", "gettext", "js/models/settings/advanced", "js/vi
<li class="nav-item"><a href="${details_url}">${_("Details &amp; Schedule")}</a></li> <li class="nav-item"><a href="${details_url}">${_("Details &amp; Schedule")}</a></li>
<li class="nav-item"><a href="${grading_url}">${_("Grading")}</a></li> <li class="nav-item"><a href="${grading_url}">${_("Grading")}</a></li>
<li class="nav-item"><a href="${course_team_url}">${_("Course Team")}</a></li> <li class="nav-item"><a href="${course_team_url}">${_("Course Team")}</a></li>
% if "split_test" in context_course.advanced_modules: % if settings.FEATURES.get('ENABLE_GROUP_CONFIGURATIONS') and "split_test" in context_course.advanced_modules:
<li class="nav-item"><a href="${group_configurations_config_url}">${_("Group Configurations")}</a></li> <li class="nav-item"><a href="${utils.reverse_course_url('group_configurations_list_handler', context_course.id)}">${_("Group Configurations")}</a></li>
% endif % endif
</ul> </ul>
</nav> </nav>
......
...@@ -141,7 +141,6 @@ require(["domReady!", "jquery", "js/views/settings/grading", "js/models/settings ...@@ -141,7 +141,6 @@ require(["domReady!", "jquery", "js/views/settings/grading", "js/models/settings
detailed_settings_url = utils.reverse_course_url('settings_handler', context_course.id) detailed_settings_url = utils.reverse_course_url('settings_handler', context_course.id)
course_team_url = utils.reverse_course_url('course_team_handler', context_course.id) course_team_url = utils.reverse_course_url('course_team_handler', context_course.id)
advanced_settings_url = utils.reverse_course_url('advanced_settings_handler', context_course.id) advanced_settings_url = utils.reverse_course_url('advanced_settings_handler', context_course.id)
group_configurations_config_url = utils.reverse_course_url('group_configurations_list_handler', context_course.id)
%> %>
<h3 class="title-3">${_("Other Course Settings")}</h3> <h3 class="title-3">${_("Other Course Settings")}</h3>
<nav class="nav-related"> <nav class="nav-related">
...@@ -149,8 +148,8 @@ require(["domReady!", "jquery", "js/views/settings/grading", "js/models/settings ...@@ -149,8 +148,8 @@ require(["domReady!", "jquery", "js/views/settings/grading", "js/models/settings
<li class="nav-item"><a href="${detailed_settings_url}">${_("Details &amp; Schedule")}</a></li> <li class="nav-item"><a href="${detailed_settings_url}">${_("Details &amp; Schedule")}</a></li>
<li class="nav-item"><a href="${course_team_url}">${_("Course Team")}</a></li> <li class="nav-item"><a href="${course_team_url}">${_("Course Team")}</a></li>
<li class="nav-item"><a href="${advanced_settings_url}">${_("Advanced Settings")}</a></li> <li class="nav-item"><a href="${advanced_settings_url}">${_("Advanced Settings")}</a></li>
% if "split_test" in context_course.advanced_modules: % if settings.FEATURES.get('ENABLE_GROUP_CONFIGURATIONS') and "split_test" in context_course.advanced_modules:
<li class="nav-item"><a href="${group_configurations_config_url}">${_("Group Configurations")}</a></li> <li class="nav-item"><a href="${utils.reverse_course_url('group_configurations_list_handler', context_course.id)}">${_("Group Configurations")}</a></li>
% endif % endif
</ul> </ul>
</nav> </nav>
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
settings_url = reverse('contentstore.views.settings_handler', kwargs={'course_key_string': unicode(course_key)}) settings_url = reverse('contentstore.views.settings_handler', kwargs={'course_key_string': unicode(course_key)})
grading_url = reverse('contentstore.views.grading_handler', kwargs={'course_key_string': unicode(course_key)}) grading_url = reverse('contentstore.views.grading_handler', kwargs={'course_key_string': unicode(course_key)})
advanced_settings_url = reverse('contentstore.views.advanced_settings_handler', kwargs={'course_key_string': unicode(course_key)}) advanced_settings_url = reverse('contentstore.views.advanced_settings_handler', kwargs={'course_key_string': unicode(course_key)})
group_configurations_config_url = reverse('contentstore.views.group_configurations_list_handler', kwargs={'course_key_string': unicode(course_key)})
tabs_url = reverse('contentstore.views.tabs_handler', kwargs={'course_key_string': unicode(course_key)}) tabs_url = reverse('contentstore.views.tabs_handler', kwargs={'course_key_string': unicode(course_key)})
%> %>
<h2 class="info-course"> <h2 class="info-course">
...@@ -85,9 +84,9 @@ ...@@ -85,9 +84,9 @@
<li class="nav-item nav-course-settings-advanced"> <li class="nav-item nav-course-settings-advanced">
<a href="${advanced_settings_url}">${_("Advanced Settings")}</a> <a href="${advanced_settings_url}">${_("Advanced Settings")}</a>
</li> </li>
% if "split_test" in context_course.advanced_modules: % if settings.FEATURES.get('ENABLE_GROUP_CONFIGURATIONS') and "split_test" in context_course.advanced_modules:
<li class="nav-item nav-course-settings-group-configurations"> <li class="nav-item nav-course-settings-group-configurations">
<a href="${group_configurations_config_url}">${_("Group Configurations")}</a> <a href="${reverse('contentstore.views.group_configurations_list_handler', kwargs={'course_key_string': unicode(course_key)})}">${_("Group Configurations")}</a>
</li> </li>
% endif % endif
</ul> </ul>
......
...@@ -90,9 +90,12 @@ urlpatterns += patterns( ...@@ -90,9 +90,12 @@ urlpatterns += patterns(
url(r'^settings/advanced/(?P<course_key_string>[^/]+)$', 'advanced_settings_handler'), url(r'^settings/advanced/(?P<course_key_string>[^/]+)$', 'advanced_settings_handler'),
url(r'^textbooks/(?P<course_key_string>[^/]+)$', 'textbooks_list_handler'), url(r'^textbooks/(?P<course_key_string>[^/]+)$', 'textbooks_list_handler'),
url(r'^textbooks/(?P<course_key_string>[^/]+)/(?P<textbook_id>\d[^/]*)$', 'textbooks_detail_handler'), url(r'^textbooks/(?P<course_key_string>[^/]+)/(?P<textbook_id>\d[^/]*)$', 'textbooks_detail_handler'),
url(r'^group_configurations/(?P<course_key_string>[^/]+)$', 'group_configurations_list_handler'),
) )
if settings.FEATURES.get('ENABLE_GROUP_CONFIGURATIONS'):
urlpatterns += (url(r'^group_configurations/(?P<course_key_string>[^/]+)$',
'contentstore.views.group_configurations_list_handler'),)
js_info_dict = { js_info_dict = {
'domain': 'djangojs', 'domain': 'djangojs',
# We need to explicitly include external Django apps that are not in LOCALE_PATHS. # We need to explicitly include external Django apps that are not in LOCALE_PATHS.
......
...@@ -3,7 +3,8 @@ Acceptance tests for Studio related to the split_test module. ...@@ -3,7 +3,8 @@ Acceptance tests for Studio related to the split_test module.
""" """
import json import json
from unittest import skip import os
from unittest import skip, skipUnless
from ..fixtures.course import CourseFixture, XBlockFixtureDesc from ..fixtures.course import CourseFixture, XBlockFixtureDesc
...@@ -162,6 +163,7 @@ class SplitTest(ContainerBase): ...@@ -162,6 +163,7 @@ class SplitTest(ContainerBase):
self.verify_groups(container, ['alpha'], [], verify_missing_groups_not_present=False) self.verify_groups(container, ['alpha'], [], verify_missing_groups_not_present=False)
@skipUnless(os.environ.get('FEATURE_GROUP_CONFIGURATIONS'), 'Tests Group Configurations feature')
class SettingsMenuTest(UniqueCourseTest): class SettingsMenuTest(UniqueCourseTest):
""" """
Tests that Setting menu is rendered correctly in Studio Tests that Setting menu is rendered correctly in Studio
...@@ -222,6 +224,7 @@ class SettingsMenuTest(UniqueCourseTest): ...@@ -222,6 +224,7 @@ class SettingsMenuTest(UniqueCourseTest):
self.assertFalse(self.advanced_settings.q(css=link_css).present) self.assertFalse(self.advanced_settings.q(css=link_css).present)
@skipUnless(os.environ.get('FEATURE_GROUP_CONFIGURATIONS'), 'Tests Group Configurations feature')
class GroupConfigurationsTest(UniqueCourseTest): class GroupConfigurationsTest(UniqueCourseTest):
""" """
Tests that Group Configurations page works correctly with previously Tests that Group Configurations page works correctly with previously
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment