diff --git a/common/djangoapps/student/tests/test_bulk_email_settings.py b/common/djangoapps/student/tests/test_bulk_email_settings.py index 522064df90..b2bca30f0b 100644 --- a/common/djangoapps/student/tests/test_bulk_email_settings.py +++ b/common/djangoapps/student/tests/test_bulk_email_settings.py @@ -13,7 +13,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey from student.tests.factories import UserFactory, CourseEnrollmentFactory from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase -from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE +from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE from xmodule.modulestore.tests.factories import CourseFactory # This import is for an lms djangoapp. @@ -90,7 +90,7 @@ class TestStudentDashboardEmailViewXMLBacked(SharedModuleStoreTestCase): """ Check for email view on student dashboard, with XML backed course. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): super(TestStudentDashboardEmailViewXMLBacked, self).setUp() diff --git a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py index 1a1298373c..faac630bd1 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/django_utils.py @@ -147,22 +147,14 @@ def drop_mongo_collections(mock_create): TEST_DATA_DIR = settings.COMMON_TEST_DATA_ROOT -# This modulestore will provide both a mixed mongo editable modulestore, and -# an XML store with just the toy course loaded. -TEST_DATA_MIXED_TOY_MODULESTORE = mixed_store_config( - TEST_DATA_DIR, {}, xml_source_dirs=['toy'] -) - -# This modulestore will provide both a mixed mongo editable modulestore, and -# an XML store with common/test/data/2014 loaded, which is a course that is closed. -TEST_DATA_MIXED_CLOSED_MODULESTORE = mixed_store_config( - TEST_DATA_DIR, {}, xml_source_dirs=['2014'] -) - -# This modulestore will provide both a mixed mongo editable modulestore, and -# an XML store with common/test/data/graded loaded, which is a course that is graded. -TEST_DATA_MIXED_GRADED_MODULESTORE = mixed_store_config( - TEST_DATA_DIR, {}, xml_source_dirs=['graded'] +# This modulestore will provide a mixed mongo editable modulestore. +# If your test uses the 'toy' course, use the the ToyCourseFactory to construct it. +# If your test needs a closed course to test against, import the common/test/data/2014 +# test course into this modulestore. +# If your test needs a graded course to test against, import the common/test/data/graded +# test course into this modulestore. +TEST_DATA_MIXED_MODULESTORE = mixed_store_config( + TEST_DATA_DIR, {} ) # All store requests now go through mixed diff --git a/lms/djangoapps/bulk_email/tests/test_forms.py b/lms/djangoapps/bulk_email/tests/test_forms.py index f2b308ef8b..5d465a05ec 100644 --- a/lms/djangoapps/bulk_email/tests/test_forms.py +++ b/lms/djangoapps/bulk_email/tests/test_forms.py @@ -8,7 +8,6 @@ from nose.plugins.attrib import attr from bulk_email.models import CourseAuthorization, CourseEmailTemplate from bulk_email.forms import CourseAuthorizationAdminForm, CourseEmailTemplateForm -from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE from opaque_keys.edx.locations import SlashSeparatedCourseKey from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory diff --git a/lms/djangoapps/courseware/tests/test_about.py b/lms/djangoapps/courseware/tests/test_about.py index 1bed645f5d..5530cd9dcc 100644 --- a/lms/djangoapps/courseware/tests/test_about.py +++ b/lms/djangoapps/courseware/tests/test_about.py @@ -14,7 +14,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey from course_modes.models import CourseMode from track.tests import EventTrackingTestCase -from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_CLOSED_MODULESTORE +from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE from xmodule.modulestore.tests.utils import TEST_DATA_DIR from xmodule.modulestore.xml_importer import import_course_from_xml @@ -201,7 +201,7 @@ class AboutTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for the course about page """ - MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ diff --git a/lms/djangoapps/courseware/tests/test_course_info.py b/lms/djangoapps/courseware/tests/test_course_info.py index 490e353121..069547e506 100644 --- a/lms/djangoapps/courseware/tests/test_course_info.py +++ b/lms/djangoapps/courseware/tests/test_course_info.py @@ -18,7 +18,7 @@ from xmodule.modulestore.tests.django_utils import ( ModuleStoreTestCase, SharedModuleStoreTestCase, TEST_DATA_SPLIT_MODULESTORE, - TEST_DATA_MIXED_CLOSED_MODULESTORE + TEST_DATA_MIXED_MODULESTORE ) from xmodule.modulestore.tests.utils import TEST_DATA_DIR from xmodule.modulestore.xml_importer import import_course_from_xml @@ -214,7 +214,7 @@ class CourseInfoTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase): """ Tests for the Course Info page for an XML course """ - MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ diff --git a/lms/djangoapps/courseware/tests/test_courses.py b/lms/djangoapps/courseware/tests/test_courses.py index fde9442fb3..6976e376ca 100644 --- a/lms/djangoapps/courseware/tests/test_courses.py +++ b/lms/djangoapps/courseware/tests/test_courses.py @@ -309,7 +309,7 @@ class CoursesRenderTest(ModuleStoreTestCase): @attr('shard_1') class XmlCoursesRenderTest(ModuleStoreTestCase): """Test methods related to rendering courses content for an XML course.""" - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ diff --git a/lms/djangoapps/courseware/tests/test_module_render.py b/lms/djangoapps/courseware/tests/test_module_render.py index ff8a7e0b90..2484c98ded 100644 --- a/lms/djangoapps/courseware/tests/test_module_render.py +++ b/lms/djangoapps/courseware/tests/test_module_render.py @@ -43,13 +43,13 @@ from openedx.core.lib.courses import course_image_url from openedx.core.lib.gating import api as gating_api from student.models import anonymous_id_for_user from xmodule.modulestore.tests.django_utils import ( - TEST_DATA_MIXED_TOY_MODULESTORE, - SharedModuleStoreTestCase + ModuleStoreTestCase, + SharedModuleStoreTestCase, + TEST_DATA_MIXED_MODULESTORE ) from xmodule.lti_module import LTIDescriptor from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore -from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import ItemFactory, CourseFactory, ToyCourseFactory, check_mongo_calls from xmodule.x_module import XModuleDescriptor, XModule, STUDENT_VIEW, CombinedSystem @@ -1403,7 +1403,7 @@ class MongoViewInStudioTest(ViewInStudioTest): class MixedViewInStudioTest(ViewInStudioTest): """Test the 'View in Studio' link visibility in a mixed mongo backed course.""" - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def test_view_in_studio_link_mongo_backed(self): """Mixed mongo courses that are mongo backed should see 'View in Studio' links.""" diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index 099732a4ec..f11d7c12d1 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -29,7 +29,8 @@ from milestones.tests.utils import MilestonesTestCaseMixin from xmodule import tabs as xmodule_tabs from xmodule.modulestore.tests.django_utils import ( ModuleStoreTestCase, - SharedModuleStoreTestCase + SharedModuleStoreTestCase, + TEST_DATA_MIXED_MODULESTORE ) from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory from xmodule.modulestore.tests.utils import TEST_DATA_DIR @@ -228,7 +229,7 @@ class TextbooksTestCase(TabTestCase): class StaticTabDateTestCase(LoginEnrollmentTestCase, SharedModuleStoreTestCase): """Test cases for Static Tab Dates.""" - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE @classmethod def setUpClass(cls): @@ -288,7 +289,7 @@ class StaticTabDateTestCaseXML(LoginEnrollmentTestCase, ModuleStoreTestCase): Tests for the static tab dates of an XML course """ - MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ @@ -338,7 +339,7 @@ class EntranceExamsTabsTestCase(LoginEnrollmentTestCase, ModuleStoreTestCase, Mi """ Validate tab behavior when dealing with Entrance Exams """ - MODULESTORE = TEST_DATA_MIXED_CLOSED_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE @patch.dict('django.conf.settings.FEATURES', {'ENTRANCE_EXAMS': True, 'MILESTONES_APP': True}) def setUp(self): @@ -445,7 +446,7 @@ class TextBookCourseViewsTestCase(LoginEnrollmentTestCase, SharedModuleStoreTest """ Validate tab behavior when dealing with textbooks. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE @classmethod def setUpClass(cls): diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index 88e84c4874..83a52fb897 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -51,7 +51,7 @@ from util.url import reload_django_url_config from util.views import ensure_valid_course_key from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.django import modulestore -from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE +from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls from openedx.core.djangoapps.credit.api import set_credit_requirements @@ -63,7 +63,7 @@ class TestJumpTo(ModuleStoreTestCase): """ Check the jumpto link for a course. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): super(TestJumpTo, self).setUp() diff --git a/lms/djangoapps/courseware/tests/tests.py b/lms/djangoapps/courseware/tests/tests.py index 5189f143c7..d376896dcb 100644 --- a/lms/djangoapps/courseware/tests/tests.py +++ b/lms/djangoapps/courseware/tests/tests.py @@ -14,7 +14,7 @@ from lms.djangoapps.lms_xblock.field_data import LmsFieldData from xmodule.error_module import ErrorDescriptor from xmodule.modulestore.django import modulestore from xmodule.modulestore.tests.django_utils import ( - ModuleStoreTestCase, TEST_DATA_MIXED_TOY_MODULESTORE + ModuleStoreTestCase, TEST_DATA_MIXED_MODULESTORE ) from xmodule.modulestore.tests.factories import ToyCourseFactory @@ -128,7 +128,7 @@ class TestMongoCoursesLoad(ModuleStoreTestCase, PageLoaderTestCase): """ Check that all pages in test courses load properly from Mongo. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): super(TestMongoCoursesLoad, self).setUp() diff --git a/lms/djangoapps/django_comment_client/tests/test_models.py b/lms/djangoapps/django_comment_client/tests/test_models.py index 17fa747e5e..5429e68661 100644 --- a/lms/djangoapps/django_comment_client/tests/test_models.py +++ b/lms/djangoapps/django_comment_client/tests/test_models.py @@ -7,7 +7,7 @@ from opaque_keys.edx.keys import CourseKey import django_comment_common.models as models from xmodule.modulestore.tests.django_utils import ( - TEST_DATA_MIXED_TOY_MODULESTORE, ModuleStoreTestCase + TEST_DATA_MIXED_MODULESTORE, ModuleStoreTestCase ) from xmodule.modulestore.tests.factories import ToyCourseFactory @@ -17,7 +17,7 @@ class RoleClassTestCase(ModuleStoreTestCase): """ Tests for roles of the comment client service integration """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): super(RoleClassTestCase, self).setUp() diff --git a/lms/djangoapps/django_comment_client/tests/test_utils.py b/lms/djangoapps/django_comment_client/tests/test_utils.py index 1d3a123bba..dd14861c71 100644 --- a/lms/djangoapps/django_comment_client/tests/test_utils.py +++ b/lms/djangoapps/django_comment_client/tests/test_utils.py @@ -26,7 +26,7 @@ from openedx.core.djangoapps.util.testing import ContentGroupTestCase from student.roles import CourseStaffRole from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, ToyCourseFactory -from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_TOY_MODULESTORE +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_MODULESTORE from xmodule.modulestore.django import modulestore from opaque_keys.edx.locator import CourseLocator from lms.djangoapps.teams.tests.factories import CourseTeamFactory @@ -1248,7 +1248,7 @@ class IsCommentableCohortedTestCase(ModuleStoreTestCase): Test the is_commentable_cohorted function. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ diff --git a/lms/djangoapps/instructor/tests/test_email.py b/lms/djangoapps/instructor/tests/test_email.py index 7f1bc0633f..3d16b31c5a 100644 --- a/lms/djangoapps/instructor/tests/test_email.py +++ b/lms/djangoapps/instructor/tests/test_email.py @@ -12,7 +12,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey from bulk_email.models import CourseAuthorization from xmodule.modulestore.tests.django_utils import ( - TEST_DATA_MIXED_TOY_MODULESTORE, SharedModuleStoreTestCase + TEST_DATA_MIXED_MODULESTORE, SharedModuleStoreTestCase ) from student.tests.factories import AdminFactory from xmodule.modulestore.tests.factories import CourseFactory @@ -112,7 +112,7 @@ class TestNewInstructorDashboardEmailViewXMLBacked(SharedModuleStoreTestCase): Check for email view on the new instructor dashboard """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE @classmethod def setUpClass(cls): diff --git a/lms/lib/xblock/test/test_mixin.py b/lms/lib/xblock/test/test_mixin.py index 64360c4a5f..6cb4d3c52c 100644 --- a/lms/lib/xblock/test/test_mixin.py +++ b/lms/lib/xblock/test/test_mixin.py @@ -6,7 +6,7 @@ import ddt from xblock.validation import ValidationMessage from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.factories import CourseFactory, ToyCourseFactory, ItemFactory -from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_TOY_MODULESTORE +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_MODULESTORE from xmodule.partitions.partitions import Group, UserPartition @@ -157,7 +157,7 @@ class XBlockGetParentTest(LmsXBlockMixinTestCase): Test that XBlock.get_parent returns correct results with each modulestore backend. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE @ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split, ModuleStoreEnum.Type.xml) def test_parents(self, modulestore_type): diff --git a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py index 0e5f23a033..0df8acedfd 100644 --- a/openedx/core/djangoapps/course_groups/tests/test_cohorts.py +++ b/openedx/core/djangoapps/course_groups/tests/test_cohorts.py @@ -16,7 +16,7 @@ from opaque_keys.edx.locations import SlashSeparatedCourseKey from student.models import CourseEnrollment from student.tests.factories import UserFactory from xmodule.modulestore.django import modulestore -from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_TOY_MODULESTORE, ModuleStoreTestCase +from xmodule.modulestore.tests.django_utils import TEST_DATA_MIXED_MODULESTORE, ModuleStoreTestCase from xmodule.modulestore.tests.factories import ToyCourseFactory from ..models import CourseUserGroup, CourseCohort, CourseUserGroupPartitionGroup @@ -139,7 +139,7 @@ class TestCohorts(ModuleStoreTestCase): """ Test the cohorts feature """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ @@ -733,7 +733,7 @@ class TestCohortsAndPartitionGroups(ModuleStoreTestCase): """ Test Cohorts and Partitions Groups. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ diff --git a/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py b/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py index f76d1ebec8..b6b1971747 100644 --- a/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py +++ b/openedx/core/djangoapps/course_groups/tests/test_partition_scheme.py @@ -15,7 +15,7 @@ from courseware.tests.test_masquerade import StaffMasqueradeTestCase from student.tests.factories import UserFactory from xmodule.partitions.partitions import Group, UserPartition, UserPartitionError from xmodule.modulestore.django import modulestore -from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_TOY_MODULESTORE +from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase, TEST_DATA_MIXED_MODULESTORE from xmodule.modulestore.tests.factories import ToyCourseFactory from opaque_keys.edx.locations import SlashSeparatedCourseKey @@ -32,7 +32,7 @@ class TestCohortPartitionScheme(ModuleStoreTestCase): """ Test the logic for linking a user to a partition group based on their cohort. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """ @@ -279,7 +279,7 @@ class TestGetCohortedUserPartition(ModuleStoreTestCase): """ Test that `get_cohorted_user_partition` returns the first user_partition with scheme `CohortPartitionScheme`. """ - MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE + MODULESTORE = TEST_DATA_MIXED_MODULESTORE def setUp(self): """