diff --git a/cms/djangoapps/contentstore/management/commands/migrate_to_split.py b/cms/djangoapps/contentstore/management/commands/migrate_to_split.py index 283193dd0f..dbba474d49 100644 --- a/cms/djangoapps/contentstore/management/commands/migrate_to_split.py +++ b/cms/djangoapps/contentstore/management/commands/migrate_to_split.py @@ -11,7 +11,7 @@ from xmodule.modulestore import InvalidLocationError from xmodule.modulestore.django import loc_mapper -def user_from_str(s): +def user_from_str(identifier): """ Return a user identified by the given string. The string could be an email address, or a stringified integer corresponding to the ID of the user in @@ -19,14 +19,16 @@ def user_from_str(s): will be raised. """ try: - user_id = int(s) + user_id = int(identifier) except ValueError: - return User.objects.get(email=s) + return User.objects.get(email=identifier) else: return User.objects.get(id=user_id) class Command(BaseCommand): + "Migrate a course from old-Mongo to split-Mongo" + help = "Migrate a course from old-Mongo to split-Mongo" args = "location email " diff --git a/cms/djangoapps/contentstore/management/commands/tests/test_delete_split_course.py b/cms/djangoapps/contentstore/management/commands/tests/test_delete_split_course.py index 02db42abc5..f8411d0967 100644 --- a/cms/djangoapps/contentstore/management/commands/tests/test_delete_split_course.py +++ b/cms/djangoapps/contentstore/management/commands/tests/test_delete_split_course.py @@ -11,9 +11,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.persistent_factories import PersistentCourseFactory from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError +# pylint: disable=E1101 class TestArgParsing(unittest.TestCase): + """ + Tests for parsing arguments for the `delete_split_course` management command + """ def setUp(self): self.command = Command() 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 d8e90bb9c2..2dd652b422 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 @@ -12,9 +12,13 @@ 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 +# pylint: disable=E1101 class TestArgParsing(unittest.TestCase): + """ + Tests for parsing arguments for the `migrate_to_split` management command + """ def setUp(self): self.command = Command() diff --git a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py index b0cd3df228..88bc6c87d9 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py @@ -225,9 +225,9 @@ class ModuleStoreTestCase(TestCase): if contentstore().fs_files: db = contentstore().fs_files.database db.connection.drop_database(db) - lm = loc_mapper() - if lm.db: - lm.location_map.drop() + location_mapper = loc_mapper() + if location_mapper.db: + location_mapper.location_map.drop() @classmethod def setUpClass(cls):