Fix broken tests by simplifying the CourseFactory
The data argument was being treated specially, but that was just because we didn't have **kwargs support. Now we do. There are two uses of data=, one we convert to kwargs, the other was actually unused, so remove it completely.
This commit is contained in:
@@ -32,13 +32,11 @@ class BaseTestXmodule(ModuleStoreTestCase):
|
||||
1. TEMPLATE_NAME
|
||||
2. DATA
|
||||
3. MODEL_DATA
|
||||
4. COURSE_DATA and USER_COUNT if needed
|
||||
|
||||
This class should not contain any tests, because TEMPLATE_NAME
|
||||
should be defined in child class.
|
||||
"""
|
||||
USER_COUNT = 2
|
||||
COURSE_DATA = {}
|
||||
|
||||
# Data from YAML common/lib/xmodule/xmodule/templates/NAME/default.yaml
|
||||
TEMPLATE_NAME = ""
|
||||
@@ -47,7 +45,7 @@ class BaseTestXmodule(ModuleStoreTestCase):
|
||||
|
||||
def setUp(self):
|
||||
|
||||
self.course = CourseFactory.create(data=self.COURSE_DATA)
|
||||
self.course = CourseFactory.create()
|
||||
|
||||
# Turn off cache.
|
||||
modulestore().request_cache = None
|
||||
|
||||
@@ -27,11 +27,11 @@ class TestGradebook(ModuleStoreTestCase):
|
||||
|
||||
modulestore().request_cache = modulestore().metadata_inheritance_cache_subsystem = None
|
||||
|
||||
course_data = {}
|
||||
kwargs = {}
|
||||
if self.grading_policy is not None:
|
||||
course_data['grading_policy'] = self.grading_policy
|
||||
kwargs['grading_policy'] = self.grading_policy
|
||||
|
||||
self.course = CourseFactory.create(data=course_data)
|
||||
self.course = CourseFactory.create(**kwargs)
|
||||
chapter = ItemFactory.create(
|
||||
parent_location=self.course.location,
|
||||
template="i4x://edx/templates/sequential/Empty",
|
||||
|
||||
Reference in New Issue
Block a user