From d8345b4b3901b1572e7e15cba8ffca3360b044f6 Mon Sep 17 00:00:00 2001 From: ichuang Date: Tue, 27 Aug 2013 18:46:50 -0400 Subject: [PATCH 1/3] fix course tabs from being imported with display_name=None due to overwriting policy --- common/lib/xmodule/xmodule/modulestore/mongo/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/base.py b/common/lib/xmodule/xmodule/modulestore/mongo/base.py index e01606af37..b1fecec120 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/base.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/base.py @@ -794,7 +794,7 @@ class MongoModuleStore(ModuleStoreBase): existing_tabs = course.tabs or [] for tab in existing_tabs: if tab.get('url_slug') == loc.name: - tab['name'] = metadata.get('display_name') + tab['name'] = tab.get('name', metadata.get('display_name')) break course.tabs = existing_tabs # Save the updates to the course to the MongoKeyValueStore From 4a706641f21657d996d6dda40d9a99180386cc18 Mon Sep 17 00:00:00 2001 From: ichuang Date: Tue, 27 Aug 2013 20:03:35 -0400 Subject: [PATCH 2/3] add test for tab names importing correctly --- cms/djangoapps/contentstore/tests/test_import_nostatic.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cms/djangoapps/contentstore/tests/test_import_nostatic.py b/cms/djangoapps/contentstore/tests/test_import_nostatic.py index 305d986372..f0f65c9b07 100644 --- a/cms/djangoapps/contentstore/tests/test_import_nostatic.py +++ b/cms/djangoapps/contentstore/tests/test_import_nostatic.py @@ -127,3 +127,9 @@ class ContentStoreImportNoStaticTest(ModuleStoreTestCase): handouts = module_store.get_item(Location(['i4x', 'edX', 'toy', 'html', 'toyhtml', None])) self.assertIn('/static/', handouts.data) + + def test_tab_name_imports_correctly(self): + module_store, content_store, course, course_location = self.load_test_import_course() + print "course tabs = {0}".format(course.tabs) + self.assertEqual(course.tabs[2]['name'],'Syllabus') + From 493d8d26e592400230f51905851a23ccfc634d5b Mon Sep 17 00:00:00 2001 From: ichuang Date: Tue, 27 Aug 2013 20:04:55 -0400 Subject: [PATCH 3/3] add sample tabs to test_import_course --- common/test/data/test_import_course/tabs/resources.html | 1 + common/test/data/test_import_course/tabs/syllabus.html | 1 + 2 files changed, 2 insertions(+) create mode 100644 common/test/data/test_import_course/tabs/resources.html create mode 100644 common/test/data/test_import_course/tabs/syllabus.html diff --git a/common/test/data/test_import_course/tabs/resources.html b/common/test/data/test_import_course/tabs/resources.html new file mode 100644 index 0000000000..0f6bdf0984 --- /dev/null +++ b/common/test/data/test_import_course/tabs/resources.html @@ -0,0 +1 @@ +
resources!
diff --git a/common/test/data/test_import_course/tabs/syllabus.html b/common/test/data/test_import_course/tabs/syllabus.html new file mode 100644 index 0000000000..45c2a7fc8f --- /dev/null +++ b/common/test/data/test_import_course/tabs/syllabus.html @@ -0,0 +1 @@ +

This is a syllabus