From 33aada6d2204bb1a95c5462d867e604dd9a7b90b Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Mon, 29 Apr 2013 16:43:32 -0400 Subject: [PATCH] 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) --- .../xmodule/xmodule/modulestore/store_utilities.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/store_utilities.py b/common/lib/xmodule/xmodule/modulestore/store_utilities.py index e90613d0da..6beffcb71d 100644 --- a/common/lib/xmodule/xmodule/modulestore/store_utilities.py +++ b/common/lib/xmodule/xmodule/modulestore/store_utilities.py @@ -13,10 +13,19 @@ def clone_course(modulestore, contentstore, source_location, dest_location, dele if not modulestore.has_item(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]) - 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)) # check to see if the source course is actually there