From e10e47d8abb6d033bad9e0e2a60ad30240cd6e37 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Wed, 29 Jan 2014 15:10:52 -0500 Subject: [PATCH] Add test for specifying locator to migrate_to_split command --- .../commands/tests/test_migrate_to_split.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/contentstore/management/commands/tests/test_migrate_to_split.py b/cms/djangoapps/contentstore/management/commands/tests/test_migrate_to_split.py index 87b7872454..215bb9d9aa 100644 --- a/cms/djangoapps/contentstore/management/commands/tests/test_migrate_to_split.py +++ b/cms/djangoapps/contentstore/management/commands/tests/test_migrate_to_split.py @@ -10,8 +10,8 @@ from contentstore.management.commands.migrate_to_split import Command from contentstore.tests.modulestore_config import TEST_MODULESTORE from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory -from xmodule.modulestore.django import modulestore -from xmodule.modulestore.django import loc_mapper +from xmodule.modulestore.django import modulestore, loc_mapper +from xmodule.modulestore.locator import CourseLocator # pylint: disable=E1101 @@ -57,7 +57,7 @@ class TestMigrateToSplit(ModuleStoreTestCase): self.user = User.objects.create_user(uname, email, password) self.course = CourseFactory() - def test_happy_path_email(self): + def test_user_email(self): call_command( "migrate_to_split", str(self.course.location), @@ -67,7 +67,7 @@ class TestMigrateToSplit(ModuleStoreTestCase): course_from_split = modulestore('split').get_course(locator) self.assertIsNotNone(course_from_split) - def test_happy_path_user_id(self): + def test_user_id(self): call_command( "migrate_to_split", str(self.course.location), @@ -76,3 +76,14 @@ class TestMigrateToSplit(ModuleStoreTestCase): locator = loc_mapper().translate_location(self.course.id, self.course.location) course_from_split = modulestore('split').get_course(locator) self.assertIsNotNone(course_from_split) + + def test_locator_string(self): + call_command( + "migrate_to_split", + str(self.course.location), + str(self.user.id), + "org.dept.name.run", + ) + locator = CourseLocator(package_id="org.dept.name.run", branch="published") + course_from_split = modulestore('split').get_course(locator) + self.assertIsNotNone(course_from_split)