Test of draft content depends on old mongo.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user