refactor: move DEFAULT_ADVANCED_MODULES to hardcoded list instead of settings
This commit is contained in:
@@ -82,6 +82,16 @@ CONTAINER_TEMPLATES = [
|
||||
"edit-title-button", "edit-upstream-alert",
|
||||
]
|
||||
|
||||
DEFAULT_ADVANCED_MODULES = [
|
||||
'google-calendar',
|
||||
'google-document',
|
||||
'lti_consumer',
|
||||
'poll',
|
||||
'split_test',
|
||||
'survey',
|
||||
'word_cloud',
|
||||
]
|
||||
|
||||
|
||||
def _advanced_component_types(show_unsupported):
|
||||
"""
|
||||
@@ -445,7 +455,7 @@ def get_component_templates(courselike, library=False): # lint-amnesty, pylint:
|
||||
# These modules should be specified as a list of strings, where the strings
|
||||
# are the names of the modules in ADVANCED_COMPONENT_TYPES that should be
|
||||
# enabled for the course.
|
||||
course_advanced_keys = list(dict.fromkeys(courselike.advanced_modules + settings.DEFAULT_ADVANCED_MODULES))
|
||||
course_advanced_keys = list(dict.fromkeys(courselike.advanced_modules + DEFAULT_ADVANCED_MODULES))
|
||||
advanced_component_templates = {
|
||||
"type": "advanced",
|
||||
"templates": [],
|
||||
|
||||
@@ -75,7 +75,7 @@ from lms.djangoapps.lms_xblock.mixin import NONSENSICAL_ACCESS_RESTRICTION
|
||||
from openedx.core.djangoapps.discussions.models import DiscussionsConfiguration
|
||||
from openedx.core.djangoapps.content_tagging import api as tagging_api
|
||||
|
||||
from ..component import component_handler, get_component_templates
|
||||
from ..component import component_handler, DEFAULT_ADVANCED_MODULES, get_component_templates
|
||||
from cms.djangoapps.contentstore.xblock_storage_handlers.view_handlers import (
|
||||
ALWAYS,
|
||||
VisibilityState,
|
||||
@@ -2970,7 +2970,7 @@ class TestComponentTemplates(CourseTestCase):
|
||||
# Check for default advanced modules
|
||||
advanced_templates = self.get_templates_of_type("advanced")
|
||||
advanced_module_keys = [t['category'] for t in advanced_templates]
|
||||
self.assertCountEqual(advanced_module_keys, settings.DEFAULT_ADVANCED_MODULES)
|
||||
self.assertCountEqual(advanced_module_keys, DEFAULT_ADVANCED_MODULES)
|
||||
|
||||
# Now fully disable video through XBlockConfiguration
|
||||
XBlockConfiguration.objects.create(name="video", enabled=False)
|
||||
@@ -3019,7 +3019,7 @@ class TestComponentTemplates(CourseTestCase):
|
||||
Test the handling of advanced component templates.
|
||||
"""
|
||||
self.course.advanced_modules.append("done")
|
||||
EXPECTED_ADVANCED_MODULES_LENGTH = len(settings.DEFAULT_ADVANCED_MODULES) + 1
|
||||
EXPECTED_ADVANCED_MODULES_LENGTH = len(DEFAULT_ADVANCED_MODULES) + 1
|
||||
self.templates = get_component_templates(self.course)
|
||||
advanced_templates = self.get_templates_of_type("advanced")
|
||||
self.assertEqual(len(advanced_templates), EXPECTED_ADVANCED_MODULES_LENGTH)
|
||||
|
||||
@@ -2938,16 +2938,3 @@ LIBRARY_ENABLED_BLOCKS = [
|
||||
'survey',
|
||||
'word_cloud',
|
||||
]
|
||||
|
||||
# .. setting_name: DEFAULT_ADVANCED_MODULES
|
||||
# .. setting_default: ['google-calendar', 'google-document', 'lti_consumer', 'poll', 'split_test', 'survey', 'word_cloud']
|
||||
# .. setting_description: List of advanced modules that are enabled by default
|
||||
DEFAULT_ADVANCED_MODULES = [
|
||||
'google-calendar',
|
||||
'google-document',
|
||||
'lti_consumer',
|
||||
'poll',
|
||||
'split_test',
|
||||
'survey',
|
||||
'word_cloud',
|
||||
]
|
||||
|
||||
@@ -336,13 +336,3 @@ COURSE_LIVE_GLOBAL_CREDENTIALS["BIG_BLUE_BUTTON"] = {
|
||||
OPENEDX_LEARNING = {
|
||||
"MEDIA": {"BACKEND": "django.core.files.storage.InMemoryStorage", "OPTIONS": {"location": MEDIA_ROOT + "_private"}}
|
||||
}
|
||||
|
||||
DEFAULT_ADVANCED_MODULES = [
|
||||
'google-calendar',
|
||||
'google-document',
|
||||
'lti_consumer',
|
||||
'poll',
|
||||
'split_test',
|
||||
'survey',
|
||||
'word_cloud',
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user