From 78cd8be24df308a50d09deb9095166280572953a Mon Sep 17 00:00:00 2001 From: Usman Khalid <2200617@gmail.com> Date: Thu, 11 Mar 2021 21:12:05 +0500 Subject: [PATCH] XMLModuleStore should use HiddenDescriptor instead of RawDescriptor. In https://github.com/edx/edx-platform/pull/25955 `HiddenDescriptor` (which was a subclass of `RawDescriptor` with a custom `student_view()`) was converted to an XBlock. It is used as the `default_class` by the `CachingDescriptorSystem` classes. However `RawDescriptor` is still being used by `XMLModuleStore`. This has been replaced by `HiddenDescriptor` as well. --- cms/djangoapps/contentstore/tests/test_courseware_index.py | 2 +- cms/envs/test.py | 2 +- common/lib/xmodule/xmodule/modulestore/tests/django_utils.py | 4 ++-- .../xmodule/modulestore/tests/test_mixed_modulestore.py | 2 +- common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py | 2 +- .../xmodule/modulestore/tests/test_split_modulestore.py | 2 +- .../xmodule/modulestore/tests/test_split_w_old_mongo.py | 2 +- common/lib/xmodule/xmodule/modulestore/tests/utils.py | 2 +- common/lib/xmodule/xmodule/modulestore/xml_importer.py | 4 ++-- lms/djangoapps/courseware/tests/test_module_render.py | 4 ++-- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_courseware_index.py b/cms/djangoapps/contentstore/tests/test_courseware_index.py index ca49b5013a..661f75b391 100644 --- a/cms/djangoapps/contentstore/tests/test_courseware_index.py +++ b/cms/djangoapps/contentstore/tests/test_courseware_index.py @@ -101,7 +101,7 @@ class MixedWithOptionsTestCase(MixedSplitTestCase): DATABASE = 'test_mongo_%s' % uuid4().hex[:5] COLLECTION = 'modulestore' ASSET_COLLECTION = 'assetstore' - DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor' + DEFAULT_CLASS = 'xmodule.hidden_module.HiddenDescriptor' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '' modulestore_options = { 'default_class': DEFAULT_CLASS, diff --git a/cms/envs/test.py b/cms/envs/test.py index e95c7e8fa6..7da57c79bd 100644 --- a/cms/envs/test.py +++ b/cms/envs/test.py @@ -98,7 +98,7 @@ BLOCK_STRUCTURES_SETTINGS['PRUNING_ACTIVE'] = True update_module_store_settings( MODULESTORE, module_store_options={ - 'default_class': 'xmodule.raw_module.RawDescriptor', + 'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'fs_root': TEST_ROOT / "data", }, doc_store_settings={ diff --git a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py index baebc10a42..3f7729b4b1 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py @@ -94,7 +94,7 @@ def draft_mongo_store_config(data_dir): """ modulestore_options = { - 'default_class': 'xmodule.raw_module.RawDescriptor', + 'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'fs_root': data_dir, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string' } @@ -121,7 +121,7 @@ def split_mongo_store_config(data_dir): Defines split module store. """ modulestore_options = { - 'default_class': 'xmodule.raw_module.RawDescriptor', + 'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'fs_root': data_dir, 'render_template': 'common.djangoapps.edxmako.shortcuts.render_to_string', } diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py index b983a6b79f..e70320ed2f 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py @@ -79,7 +79,7 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest): COLLECTION = 'modulestore' ASSET_COLLECTION = 'assetstore' FS_ROOT = DATA_DIR - DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor' + DEFAULT_CLASS = 'xmodule.hidden_module.HiddenDescriptor' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '' MONGO_COURSEID = 'MITx/999/2013_Spring' diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py index 4d81e6081e..08da4cfa75 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mongo.py @@ -49,7 +49,7 @@ DB = 'test_mongo_%s' % uuid4().hex[:5] COLLECTION = 'modulestore' ASSET_COLLECTION = 'assetstore' FS_ROOT = DATA_DIR # TODO (vshnayder): will need a real fs_root for testing load_item -DEFAULT_CLASS = 'xmodule.raw_module.RawDescriptor' +DEFAULT_CLASS = 'xmodule.hidden_module.HiddenDescriptor' RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '' diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py index 9779640677..fb4768ee6b 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_modulestore.py @@ -61,7 +61,7 @@ class SplitModuleTest(unittest.TestCase): 'collection': 'modulestore', } modulestore_options = { - 'default_class': 'xmodule.raw_module.RawDescriptor', + 'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'fs_root': tempdir.mkdtemp_clean(), 'xblock_mixins': (InheritanceMixin, XModuleMixin, EditInfoMixin) } diff --git a/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py b/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py index 7cd1537cfa..2798bcc9fe 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py @@ -42,7 +42,7 @@ class SplitWMongoCourseBootstrapper(unittest.TestCase): } modulestore_options = { - 'default_class': 'xmodule.raw_module.RawDescriptor', + 'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'fs_root': '', 'render_template': mock.Mock(return_value=""), 'xblock_mixins': (InheritanceMixin, XModuleMixin) diff --git a/common/lib/xmodule/xmodule/modulestore/tests/utils.py b/common/lib/xmodule/xmodule/modulestore/tests/utils.py index 5208ad183c..60a22b3d11 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/utils.py @@ -105,7 +105,7 @@ class MixedSplitTestCase(TestCase): """ RENDER_TEMPLATE = lambda t_n, d, ctx=None, nsp='main': '{}: {}, {}'.format(t_n, repr(d), repr(ctx)) modulestore_options = { - 'default_class': 'xmodule.raw_module.RawDescriptor', + 'default_class': 'xmodule.hidden_module.HiddenDescriptor', 'fs_root': DATA_DIR, 'render_template': RENDER_TEMPLATE, 'xblock_mixins': (EditInfoMixin, InheritanceMixin, LocationMixin, XModuleMixin), diff --git a/common/lib/xmodule/xmodule/modulestore/xml_importer.py b/common/lib/xmodule/xmodule/modulestore/xml_importer.py index 24194131af..a331779bd1 100644 --- a/common/lib/xmodule/xmodule/modulestore/xml_importer.py +++ b/common/lib/xmodule/xmodule/modulestore/xml_importer.py @@ -227,7 +227,7 @@ class ImportManager: def __init__( self, store, user_id, data_dir, source_dirs=None, - default_class='xmodule.raw_module.RawDescriptor', + default_class='xmodule.hidden_module.HiddenDescriptor', load_error_modules=True, static_content_store=None, target_id=None, verbose=False, do_import_static=True, do_import_python_lib=True, @@ -1182,7 +1182,7 @@ def validate_course_policy(module_store, course_id): def perform_xlint( # lint-amnesty, pylint: disable=missing-function-docstring data_dir, source_dirs, - default_class='xmodule.raw_module.RawDescriptor', + default_class='xmodule.hidden_module.HiddenDescriptor', load_error_modules=True, xblock_mixins=(LocationMixin, XModuleMixin)): err_cnt = 0 diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index 9b474668b5..0c8472abe6 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -2504,7 +2504,7 @@ class TestDisabledXBlockTypes(ModuleStoreTestCase): def test_get_item(self, default_ms): with self.store.default_store(default_ms): course = CourseFactory() - self._verify_descriptor('video', course, 'RawDescriptorWithMixins') + self._verify_descriptor('video', course, 'HiddenDescriptorWithMixins') @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split) def test_dynamic_updates(self, default_ms): @@ -2519,7 +2519,7 @@ class TestDisabledXBlockTypes(ModuleStoreTestCase): # Now simulate a new request cache. self.store.request_cache.data.clear() - self._verify_descriptor('problem', course, 'RawDescriptorWithMixins', item_usage_id) + self._verify_descriptor('problem', course, 'HiddenDescriptorWithMixins', item_usage_id) def _verify_descriptor(self, category, course, descriptor, item_id=None): """