Fix tests and extend export/import unit test with draft testing.

This commit is contained in:
Chris Dodge
2013-04-03 11:28:25 -04:00
parent b61d7b2c3c
commit 1a1635d402
3 changed files with 38 additions and 14 deletions

View File

@@ -54,13 +54,14 @@ def export_to_xml(modulestore, contentstore, course_location, root_dir, course_d
# NOTE: this code assumes that verticals are the top most draftable container
# should we change the application, then this assumption will no longer
# be valid
draft_items = draft_modulestore.get_items([None, course_location.org, course_location.course,
'vertical', None, 'draft'])
if draft_modulestore is not None:
draft_items = draft_modulestore.get_items([None, course_location.org, course_location.course,
'vertical', None, 'draft'])
if len(draft_items)>0:
draft_course_dir = export_fs.makeopendir('drafts')
for draft_item in draft_items:
draft_item.export_to_xml(draft_course_dir)
if len(draft_items)>0:
draft_course_dir = export_fs.makeopendir('drafts')
for draft_item in draft_items:
draft_item.export_to_xml(draft_course_dir)
def export_extra_content(export_fs, modulestore, course_location, category_type, dirname, file_suffix=''):

View File

@@ -276,6 +276,12 @@ def import_from_xml(store, data_dir, course_dirs=None,
import_module(module, store, course_data_path, static_content_store)
# now import any 'draft' items
if draft_store is not None:
import_course_draft(xml_module_store, draft_store, course_data_path,
static_content_store, target_location_namespace if target_location_namespace is not None
else course_location)
finally:
# turn back on all write signalling
if pseudo_course_id in store.ignore_write_events_on_courses:
@@ -283,10 +289,6 @@ def import_from_xml(store, data_dir, course_dirs=None,
store.refresh_cached_metadata_inheritance_tree(target_location_namespace if
target_location_namespace is not None else course_location)
# now import any 'draft' items
if draft_store is not None:
import_course_draft(xml_module_store, draft_store, course_data_path, static_content_store, target_location_namespace)
return xml_module_store, course_items
def import_module(module, store, course_data_path, static_content_store, allow_not_found=False):