Commit 33aada6d by Chris Dodge

fix broken test. Since we're pre-populating the course overview when creating a…

fix broken test. Since we're pre-populating the course overview when creating a course, the clone_course fails because it asserts that the destination course that it clones into is empty. Need to check that the course is basically empty (e.g. a course module and a overview module)
parent a861c8b3
...@@ -13,10 +13,19 @@ def clone_course(modulestore, contentstore, source_location, dest_location, dele ...@@ -13,10 +13,19 @@ def clone_course(modulestore, contentstore, source_location, dest_location, dele
if not modulestore.has_item(dest_location): if not modulestore.has_item(dest_location):
raise Exception("An empty course at {0} must have already been created. Aborting...".format(dest_location)) raise Exception("An empty course at {0} must have already been created. Aborting...".format(dest_location))
# verify that the dest_location really is an empty course, which means only one # verify that the dest_location really is an empty course, which means only one with an optional 'overview'
dest_modules = modulestore.get_items([dest_location.tag, dest_location.org, dest_location.course, None, None, None]) dest_modules = modulestore.get_items([dest_location.tag, dest_location.org, dest_location.course, None, None, None])
if len(dest_modules) != 1: basically_empty = True
for module in dest_modules:
if module.location.category == 'course' or (module.location.category == 'about'
and module.location.name == 'overview'):
continue
basically_empty = False
break
if not basically_empty:
raise Exception("Course at destination {0} is not an empty course. You can only clone into an empty course. Aborting...".format(dest_location)) raise Exception("Course at destination {0} is not an empty course. You can only clone into an empty course. Aborting...".format(dest_location))
# check to see if the source course is actually there # check to see if the source course is actually there
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment