add unit test to verify that the store updated signal actually fired. Also fix bug where cloning item doesn't update the inherited metadata caches

This commit is contained in:
Chris Dodge
2013-04-06 10:43:40 -04:00
parent a3de4ff625
commit 7c48f9a5ed
2 changed files with 30 additions and 1 deletions

View File

@@ -537,6 +537,7 @@ class MongoModuleStore(ModuleStoreBase):
Clone a new item that is a copy of the item at the location `source`
and writes it to `location`
"""
item = None
try:
source_item = self.collection.find_one(location_to_query(source))
@@ -568,7 +569,6 @@ class MongoModuleStore(ModuleStoreBase):
course.tabs = existing_tabs
self.update_metadata(course.location, course._model_data._kvs._metadata)
return item
except pymongo.errors.DuplicateKeyError:
raise DuplicateItemError(location)
@@ -576,6 +576,8 @@ class MongoModuleStore(ModuleStoreBase):
self.refresh_cached_metadata_inheritance_tree(Location(location))
self.fire_updated_modulestore_signal(get_course_id_no_run(Location(location)), Location(location))
return item
def fire_updated_modulestore_signal(self, course_id, location):
if self.modulestore_update_signal is not None:
self.modulestore_update_signal.send(self, modulestore=self, course_id=course_id,