From 7987b16a181da57b988c276de50369bfbf8fa8c5 Mon Sep 17 00:00:00 2001 From: John Eskew Date: Mon, 21 Dec 2015 12:28:59 -0500 Subject: [PATCH] Remove XML modulestore code - discovery work --- .../tests/test_courseware_index.py | 9 ----- .../lib/xmodule/xmodule/modulestore/mixed.py | 11 +------ .../xmodule/modulestore/tests/django_utils.py | 25 -------------- .../tests/test_mixed_modulestore.py | 9 ----- .../courseware/tests/test_module_render.py | 33 ++----------------- lms/djangoapps/courseware/tests/tests.py | 19 ----------- lms/envs/common.py | 8 ----- 7 files changed, 3 insertions(+), 111 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_courseware_index.py b/cms/djangoapps/contentstore/tests/test_courseware_index.py index 6e3191c27e..155b5956d3 100644 --- a/cms/djangoapps/contentstore/tests/test_courseware_index.py +++ b/cms/djangoapps/contentstore/tests/test_courseware_index.py @@ -124,15 +124,6 @@ class MixedWithOptionsTestCase(MixedSplitTestCase): 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': modulestore_options }, - { - 'NAME': 'xml', - 'ENGINE': 'xmodule.modulestore.xml.XMLModuleStore', - 'OPTIONS': { - 'data_dir': DATA_DIR, - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', - 'xblock_mixins': modulestore_options['xblock_mixins'], - } - }, ], 'xblock_mixins': modulestore_options['xblock_mixins'], } diff --git a/common/lib/xmodule/xmodule/modulestore/mixed.py b/common/lib/xmodule/xmodule/modulestore/mixed.py index adceb85aa6..78eb0fd36c 100644 --- a/common/lib/xmodule/xmodule/modulestore/mixed.py +++ b/common/lib/xmodule/xmodule/modulestore/mixed.py @@ -1,7 +1,7 @@ """ MixedModuleStore allows for aggregation between multiple modulestores. -In this way, courses can be served up both - say - XMLModuleStore or MongoModuleStore +In this way, courses can be served up via either SplitMongoModuleStore or MongoModuleStore. """ @@ -169,15 +169,6 @@ class MixedModuleStore(ModuleStoreDraftAndPublished, ModuleStoreWriteBase): for store_settings in stores: key = store_settings['NAME'] - is_xml = 'XMLModuleStore' in store_settings['ENGINE'] - if is_xml: - # restrict xml to only load courses in mapping - store_settings['OPTIONS']['course_ids'] = [ - course_key.to_deprecated_string() - for course_key, store_key in self.mappings.iteritems() - if store_key == key - ] - store = create_modulestore_instance( store_settings['ENGINE'], self.contentstore, diff --git a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py index 5d5859fb90..101e909e96 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py @@ -140,28 +140,6 @@ def split_mongo_store_config(data_dir): return store -def xml_store_config(data_dir, source_dirs=None): - """ - Defines default module store using XMLModuleStore. - - Note: you should pass in a list of source_dirs that you care about, - otherwise all courses in the data_dir will be processed. - """ - store = { - 'default': { - 'NAME': 'xml', - 'ENGINE': 'xmodule.modulestore.xml.XMLModuleStore', - 'OPTIONS': { - 'data_dir': data_dir, - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', - 'source_dirs': source_dirs, - } - } - } - - return store - - @patch('xmodule.modulestore.django.create_modulestore_instance', autospec=True) def drop_mongo_collections(mock_create): """ @@ -180,9 +158,6 @@ def drop_mongo_collections(mock_create): TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT -# This is an XML only modulestore with only the toy course loaded -TEST_DATA_XML_MODULESTORE = xml_store_config(TEST_DATA_DIR, source_dirs=['toy']) - # This modulestore will provide both a mixed mongo editable modulestore, and # an XML store with just the toy course loaded. TEST_DATA_MIXED_TOY_MODULESTORE = mixed_store_config( 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 63cad4a892..42f3559408 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/test_mixed_modulestore.py @@ -110,15 +110,6 @@ class CommonMixedModuleStoreSetup(CourseComparisonTest): 'DOC_STORE_CONFIG': DOC_STORE_CONFIG, 'OPTIONS': modulestore_options }, - { - 'NAME': ModuleStoreEnum.Type.xml, - 'ENGINE': 'xmodule.modulestore.xml.XMLModuleStore', - 'OPTIONS': { - 'data_dir': DATA_DIR, - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', - 'xblock_mixins': modulestore_options['xblock_mixins'], - } - }, ], 'xblock_mixins': modulestore_options['xblock_mixins'], } diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index 0c1224667d..ff8a7e0b90 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -44,8 +44,8 @@ from openedx.core.lib.gating import api as gating_api from student.models import anonymous_id_for_user from xmodule.modulestore.tests.django_utils import ( TEST_DATA_MIXED_TOY_MODULESTORE, - TEST_DATA_XML_MODULESTORE, - SharedModuleStoreTestCase) + SharedModuleStoreTestCase +) from xmodule.lti_module import LTIDescriptor from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore @@ -1369,17 +1369,6 @@ class ViewInStudioTest(ModuleStoreTestCase): # pylint: disable=attribute-defined-outside-init self.child_module = self._get_module(course.id, child_descriptor, child_descriptor.location) - def setup_xml_course(self): - """ - Define the XML backed course to use. - Toy courses are already loaded in XML and mixed modulestores. - """ - course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall') - location = course_key.make_usage_key('chapter', 'Overview') - descriptor = modulestore().get_item(location) - - self.module = self._get_module(course_key, descriptor, location) - @attr('shard_1') class MongoViewInStudioTest(ViewInStudioTest): @@ -1428,24 +1417,6 @@ class MixedViewInStudioTest(ViewInStudioTest): result_fragment = self.module.render(STUDENT_VIEW, context=self.default_context) self.assertNotIn('View Unit in Studio', result_fragment.content) - def test_view_in_studio_link_xml_backed(self): - """Course in XML only modulestore should not see 'View in Studio' links.""" - self.setup_xml_course() - result_fragment = self.module.render(STUDENT_VIEW, context=self.default_context) - self.assertNotIn('View Unit in Studio', result_fragment.content) - - -@attr('shard_1') -class XmlViewInStudioTest(ViewInStudioTest): - """Test the 'View in Studio' link visibility in an xml backed course.""" - MODULESTORE = TEST_DATA_XML_MODULESTORE - - def test_view_in_studio_link_xml_backed(self): - """Course in XML only modulestore should not see 'View in Studio' links.""" - self.setup_xml_course() - result_fragment = self.module.render(STUDENT_VIEW) - self.assertNotIn('View Unit in Studio', result_fragment.content) - @XBlock.tag("detached") class DetachedXBlock(XBlock): diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index 85cb97b423..32e658d9aa 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -10,7 +10,6 @@ from nose.plugins.attrib import attr from opaque_keys.edx.locations import SlashSeparatedCourseKey from courseware.tests.helpers import LoginEnrollmentTestCase -from xmodule.modulestore.tests.django_utils import TEST_DATA_XML_MODULESTORE as XML_MODULESTORE from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE as TOY_MODULESTORE from lms.djangoapps.lms_xblock.field_data import LmsFieldData from xmodule.error_module import ErrorDescriptor @@ -122,24 +121,6 @@ class PageLoaderTestCase(LoginEnrollmentTestCase): self.assertNotIsInstance(descriptor, ErrorDescriptor) -@attr('shard_1') -class TestXmlCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase): - """ - Check that all pages in test courses load properly from XML. - """ - MODULESTORE = XML_MODULESTORE - - def setUp(self): - super(TestXmlCoursesLoad, self).setUp() - self.setup_user() - - def test_toy_course_loads(self): - # Load one of the XML based courses - # Our test mapping rules allow the MixedModuleStore - # to load this course from XML, not Mongo. - self.check_all_pages_load(SlashSeparatedCourseKey('edX', 'toy', '2012_Fall')) - - @attr('shard_1') class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase): """ diff --git a/lms/envs/common.py b/lms/envs/common.py index 8da0003274..ebe48f03b0 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -739,14 +739,6 @@ MODULESTORE = { 'fs_root': DATA_DIR, 'render_template': 'edxmako.shortcuts.render_to_string', } - }, - { - 'NAME': 'xml', - 'ENGINE': 'xmodule.modulestore.xml.XMLModuleStore', - 'OPTIONS': { - 'data_dir': DATA_DIR, - 'default_class': 'xmodule.hidden_module.HiddenDescriptor', - } } ] }