From f5d3d6050d873d16faec658ff7c7cc04e3af811b Mon Sep 17 00:00:00 2001 From: cahrens Date: Tue, 27 Jan 2015 09:42:34 -0500 Subject: [PATCH] Test of draft content depends on old mongo. --- .../contentstore/tests/test_import_pure_xblock.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_import_pure_xblock.py b/cms/djangoapps/contentstore/tests/test_import_pure_xblock.py index e2b5fd73cc..af821fcff2 100644 --- a/cms/djangoapps/contentstore/tests/test_import_pure_xblock.py +++ b/cms/djangoapps/contentstore/tests/test_import_pure_xblock.py @@ -5,6 +5,8 @@ Integration tests for importing courses containing pure XBlocks. from xblock.core import XBlock from xblock.fields import String +from xmodule.modulestore.django import modulestore +from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.xml_importer import import_from_xml from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.mongo.draft import as_draft @@ -60,8 +62,11 @@ class XBlockImportTest(ModuleStoreTestCase): the expected field value set. """ + # It is necessary to use the "old mongo" modulestore because split doesn't work + # with the "has_draft" logic below. + store = modulestore()._get_modulestore_by_type(ModuleStoreEnum.Type.mongo) # pylint: disable=protected-access courses = import_from_xml( - self.store, self.user.id, TEST_DATA_DIR, [course_dir] + store, self.user.id, TEST_DATA_DIR, [course_dir], create_course_if_not_present=True ) xblock_location = courses[0].id.make_usage_key('stubxblock', 'xblock_test') @@ -69,12 +74,12 @@ class XBlockImportTest(ModuleStoreTestCase): if has_draft: xblock_location = as_draft(xblock_location) - xblock = self.store.get_item(xblock_location) + xblock = store.get_item(xblock_location) self.assertTrue(isinstance(xblock, StubXBlock)) self.assertEqual(xblock.test_field, expected_field_val) if has_draft: - draft_xblock = self.store.get_item(xblock_location) + draft_xblock = store.get_item(xblock_location) self.assertTrue(getattr(draft_xblock, 'is_draft', False)) self.assertTrue(isinstance(draft_xblock, StubXBlock)) self.assertEqual(draft_xblock.test_field, expected_field_val)