Commit fbd9a126 by Don Mitchell

Merge pull request #1393 from MITx/fix/cdodge/export-static-tabs

add exporting of course info
parents 5f170d11 ab9d30cb
......@@ -445,6 +445,17 @@ class ContentStoreTest(TestCase):
items = ms.get_items(Location(['i4x','edX', 'full', 'vertical', None]))
self.assertEqual(len(items), 0)
def verify_content_existence(self, modulestore, root_dir, location, dirname, category_name, filename_suffix=''):
fs = OSFS(root_dir / 'test_export')
self.assertTrue(fs.exists(dirname))
query_loc = Location('i4x', location.org, location.course, category_name, None)
items = modulestore.get_items(query_loc)
for item in items:
fs = OSFS(root_dir / ('test_export/' + dirname))
self.assertTrue(fs.exists(item.location.name + filename_suffix))
def test_export_course(self):
ms = modulestore('direct')
cs = contentstore()
......@@ -460,26 +471,14 @@ class ContentStoreTest(TestCase):
export_to_xml(ms, cs, location, root_dir, 'test_export')
# check for static tabs
fs = OSFS(root_dir / 'test_export')
self.assertTrue(fs.exists('tabs'))
static_tabs_query_loc = Location('i4x', location.org, location.course, 'static_tab', None)
static_tabs = ms.get_items(static_tabs_query_loc)
for static_tab in static_tabs:
fs = OSFS(root_dir / 'test_export/tabs')
self.assertTrue(fs.exists(static_tab.location.name + '.html'))
self.verify_content_existence(ms, root_dir, location, 'tabs', 'static_tab', '.html')
# check for custom_tags
fs = OSFS(root_dir / 'test_export')
self.assertTrue(fs.exists('custom_tags'))
custom_tags_query_loc = Location('i4x', location.org, location.course, 'custom_tag_template', None)
custom_tags = ms.get_items(custom_tags_query_loc)
self.verify_content_existence(ms, root_dir, location, 'info', 'course_info', '.html')
for custom_tag in custom_tags:
fs = OSFS(root_dir / 'test_export/custom_tags')
self.assertTrue(fs.exists(custom_tag.location.name))
# check for custom_tags
self.verify_content_existence(ms, root_dir, location, 'custom_tags', 'custom_tag_template')
# remove old course
delete_course(ms, cs, location)
......@@ -496,6 +495,7 @@ class ContentStoreTest(TestCase):
shutil.rmtree(root_dir)
def test_course_handouts_rewrites(self):
ms = modulestore('direct')
cs = contentstore()
......
......@@ -23,6 +23,9 @@ def export_to_xml(modulestore, contentstore, course_location, root_dir, course_d
# export the custom tags
export_extra_content(export_fs, modulestore, course_location, 'custom_tag_template', 'custom_tags')
# export the course updates
export_extra_content(export_fs, modulestore, course_location, 'course_info', 'info', '.html')
def export_extra_content(export_fs, modulestore, course_location, category_type, dirname, file_suffix = ''):
query_loc = Location('i4x', course_location.org, course_location.course, category_type, None)
......
This is another sample tab
\ No newline at end of file
<p>This is another sample tab</p>
\ No newline at end of file
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