Merge pull request #11042 from edx/jeskew/xml_removal

Remove XML modulestore code from most tests.
This commit is contained in:
John Eskew
2016-04-27 11:20:02 -04:00
36 changed files with 190 additions and 510 deletions

View File

@@ -16,7 +16,8 @@ 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
from .. import cohorts
@@ -138,14 +139,14 @@ class TestCohorts(ModuleStoreTestCase):
"""
Test the cohorts feature
"""
MODULESTORE = TEST_DATA_MIXED_TOY_MODULESTORE
MODULESTORE = TEST_DATA_MIXED_MODULESTORE
def setUp(self):
"""
Make sure that course is reloaded every time--clear out the modulestore.
"""
super(TestCohorts, self).setUp()
self.toy_course_key = SlashSeparatedCourseKey("edX", "toy", "2012_Fall")
self.toy_course_key = ToyCourseFactory.create().id
def _create_cohort(self, course_id, cohort_name, assignment_type):
"""
@@ -732,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):
"""
@@ -740,7 +741,7 @@ class TestCohortsAndPartitionGroups(ModuleStoreTestCase):
"""
super(TestCohortsAndPartitionGroups, self).setUp()
self.test_course_key = SlashSeparatedCourseKey("edX", "toy", "2012_Fall")
self.test_course_key = ToyCourseFactory.create().id
self.course = modulestore().get_course(self.test_course_key)
self.first_cohort = CohortFactory(course_id=self.course.id, name="FirstCohort")

View File

@@ -15,7 +15,8 @@ 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
from openedx.core.djangoapps.user_api.partition_schemes import RandomUserPartitionScheme
@@ -31,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):
"""
@@ -40,7 +41,7 @@ class TestCohortPartitionScheme(ModuleStoreTestCase):
"""
super(TestCohortPartitionScheme, self).setUp()
self.course_key = SlashSeparatedCourseKey("edX", "toy", "2012_Fall")
self.course_key = ToyCourseFactory.create().id
self.course = modulestore().get_course(self.course_key)
config_course_cohorts(self.course, is_cohorted=True)
@@ -278,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):
"""
@@ -286,7 +287,7 @@ class TestGetCohortedUserPartition(ModuleStoreTestCase):
and a student for each test.
"""
super(TestGetCohortedUserPartition, self).setUp()
self.course_key = SlashSeparatedCourseKey("edX", "toy", "2012_Fall")
self.course_key = ToyCourseFactory.create().id
self.course = modulestore().get_course(self.course_key)
self.student = UserFactory.create()