Addressed pull request feedback.

This commit is contained in:
Jean Manuel Nater
2013-06-21 14:05:57 -04:00
parent 905d884aa7
commit 9bfddd4891
17 changed files with 694 additions and 1150 deletions

View File

@@ -14,6 +14,22 @@ class ModuleStoreTestCase(TestCase):
collection with templates before running the TestCase
and drops it they are finished. """
def update_course(self, course, data):
"""
Updates the version of course in the mongo modulestore
with the metadata in data and returns the updated version.
"""
store = xmodule.modulestore.django.modulestore()
store.update_item(course.location, data)
store.update_metadata(course.location, data)
updated_course = store.get_instance(course.id, course.location)
return updated_course
@staticmethod
def flush_mongo_except_templates():
'''

View File

@@ -60,6 +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.'''
new_course = store.get_instance(new_course.id, new_course.location)
return new_course
@@ -150,6 +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.'''
new_item = store.get_item(new_item.location)
return new_item