From 149c4e78c118117af3cb5fcabd3fa6a2ae36e7a3 Mon Sep 17 00:00:00 2001 From: cahrens Date: Thu, 5 Feb 2015 12:30:15 -0500 Subject: [PATCH] Update tests in reaction to ModuleStoreTestCase cleanup. --- .../contentstore/tests/test_import.py | 3 +- .../contentstore/tests/test_utils.py | 2 +- .../commands/tests/test_dump_course.py | 28 +++++++++++++------ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_import.py b/cms/djangoapps/contentstore/tests/test_import.py index bf75b96f2b..8a4006943b 100644 --- a/cms/djangoapps/contentstore/tests/test_import.py +++ b/cms/djangoapps/contentstore/tests/test_import.py @@ -91,7 +91,8 @@ class ContentStoreImportTest(ModuleStoreTestCase): TEST_DATA_DIR, ['2014_Uni'], target_course_id=course_id, - create_course_if_not_present=True + # When this test is run with split modulestore as the default, the create course option must be specified. + # create_course_if_not_present=True ) course = module_store.get_course(course_id) diff --git a/cms/djangoapps/contentstore/tests/test_utils.py b/cms/djangoapps/contentstore/tests/test_utils.py index f7faea20ee..4c44f999b8 100644 --- a/cms/djangoapps/contentstore/tests/test_utils.py +++ b/cms/djangoapps/contentstore/tests/test_utils.py @@ -203,7 +203,7 @@ class CourseImageTestCase(ModuleStoreTestCase): ) -class XBlockVisibilityTestCase(TestCase): +class XBlockVisibilityTestCase(ModuleStoreTestCase): """Tests for xblock visibility for students.""" def setUp(self): diff --git a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py index 708bb80dcc..fc13685384 100644 --- a/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py +++ b/lms/djangoapps/courseware/management/commands/tests/test_dump_course.py @@ -13,13 +13,13 @@ import factory from django.conf import settings from django.core.management import call_command from django.test.utils import override_settings -from django.test.testcases import TestCase -from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, mixed_store_config -from xmodule.modulestore.tests.django_utils import TEST_DATA_MONGO_MODULESTORE +from xmodule.modulestore.tests.django_utils import ( + TEST_DATA_MONGO_MODULESTORE, TEST_DATA_MONGO_MODULESTORE_SPLIT_DEFAULT +) from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.xml_importer import import_from_xml @@ -36,7 +36,7 @@ TEST_DATA_MIXED_XML_MODULESTORE = mixed_store_config( ) -class CommandsTestBase(TestCase): +class CommandsTestBase(ModuleStoreTestCase): """ Base class for testing different django commands. @@ -44,6 +44,7 @@ class CommandsTestBase(TestCase): to be tested. """ + __test__ = False def setUp(self): super(CommandsTestBase, self).setUp() @@ -204,17 +205,28 @@ class CommandsTestBase(TestCase): assert_in('edX-simple-2012_Fall/sequential/Lecture_2.xml', names) -class CommandsXMLTestCase(CommandsTestBase, ModuleStoreTestCase): +class CommandsXMLTestCase(CommandsTestBase): """ - Test case for management commands using the xml modulestore. + Test case for management commands with the xml modulestore present. """ MODULESTORE = TEST_DATA_MIXED_XML_MODULESTORE + __test__ = True -class CommandsMongoTestCase(CommandsTestBase, ModuleStoreTestCase): +class CommandsMongoTestCase(CommandsTestBase): """ - Test case for management commands using the mixed mongo modulestore. + Test case for management commands using the mixed mongo modulestore with old mongo as the default. """ MODULESTORE = TEST_DATA_MONGO_MODULESTORE + __test__ = True + + +class CommandSplitMongoTestCase(CommandsTestBase): + """ + Test case for management commands using the mixed mongo modulestore with split as the default. + + """ + MODULESTORE = TEST_DATA_MONGO_MODULESTORE_SPLIT_DEFAULT + __test__ = True