Commit d88b0c48 by cahrens

store.has_course fails on old mongo with unicode chars.

xml_importer now calls store.has_course even if create_course_if_not_present is False.
parent 78a8fd80
...@@ -83,23 +83,24 @@ class ContentStoreImportTest(ModuleStoreTestCase): ...@@ -83,23 +83,24 @@ class ContentStoreImportTest(ModuleStoreTestCase):
""" """
# Test that importing course with unicode 'id' and 'display name' doesn't give UnicodeEncodeError # Test that importing course with unicode 'id' and 'display name' doesn't give UnicodeEncodeError
""" """
module_store = modulestore() # Test with the split modulestore because store.has_course fails in old mongo with unicode characters.
course_id = module_store.make_course_key(u'Юникода', u'unicode_course', u'échantillon') with modulestore().default_store(ModuleStoreEnum.Type.split):
import_from_xml( module_store = modulestore()
module_store, course_id = module_store.make_course_key(u'Юникода', u'unicode_course', u'échantillon')
self.user.id, import_from_xml(
TEST_DATA_DIR, module_store,
['2014_Uni'], self.user.id,
target_course_id=course_id, TEST_DATA_DIR,
# When this test is run with split modulestore as the default, the create course option must be specified. ['2014_Uni'],
# create_course_if_not_present=True target_course_id=course_id,
) create_course_if_not_present=True
)
course = module_store.get_course(course_id)
self.assertIsNotNone(course) course = module_store.get_course(course_id)
self.assertIsNotNone(course)
# test that course 'display_name' same as imported course 'display_name'
self.assertEqual(course.display_name, u"Φυσικά το όνομα Unicode") # test that course 'display_name' same as imported course 'display_name'
self.assertEqual(course.display_name, u"Φυσικά το όνομα Unicode")
def test_static_import(self): def test_static_import(self):
''' '''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment