In the middle of addressing pull request comments. This is a safety commit in case I have to revert some changes I'm about to make.
This commit is contained in:
@@ -14,10 +14,16 @@ class ModuleStoreTestCase(TestCase):
|
||||
collection with templates before running the TestCase
|
||||
and drops it they are finished. """
|
||||
|
||||
def update_course(self, course, data):
|
||||
@staticmethod
|
||||
def update_course(course, data):
|
||||
"""
|
||||
Updates the version of course in the mongo modulestore
|
||||
with the metadata in data and returns the updated version.
|
||||
|
||||
'course' is an instance of CourseDescriptor for which we want
|
||||
to update metadata.
|
||||
|
||||
'data' is a dictionary with an entry for each CourseField we want to update.
|
||||
"""
|
||||
|
||||
store = xmodule.modulestore.django.modulestore()
|
||||
|
||||
@@ -60,8 +60,8 @@ class XModuleCourseFactory(Factory):
|
||||
if data is not None:
|
||||
store.update_item(new_course.location, data)
|
||||
|
||||
'''update_item updates the the course as it exists in the modulestore, but doesn't
|
||||
update the instance we are working with, so have to refetch the course after updating it.'''
|
||||
#update_item updates the the course as it exists in the modulestore, but doesn't
|
||||
#update the instance we are working with, so have to refetch the course after updating it.
|
||||
new_course = store.get_instance(new_course.id, new_course.location)
|
||||
|
||||
return new_course
|
||||
@@ -152,8 +152,8 @@ class XModuleItemFactory(Factory):
|
||||
if new_item.location.category not in DETACHED_CATEGORIES:
|
||||
store.update_children(parent_location, parent.children + [new_item.location.url()])
|
||||
|
||||
'''update_children updates the the item as it exists in the modulestore, but doesn't
|
||||
update the instance we are working with, so have to refetch the item after updating it.'''
|
||||
#update_children updates the the item as it exists in the modulestore, but doesn't
|
||||
#update the instance we are working with, so have to refetch the item after updating it.
|
||||
new_item = store.get_item(new_item.location)
|
||||
|
||||
return new_item
|
||||
|
||||
Reference in New Issue
Block a user