+ Staff Member #1
+Biography of instructor/staff member #1
+diff --git a/cms/djangoapps/contentstore/tests/test_contentstore.py b/cms/djangoapps/contentstore/tests/test_contentstore.py
index 0b028cdca068..4baacbc995d8 100644
--- a/cms/djangoapps/contentstore/tests/test_contentstore.py
+++ b/cms/djangoapps/contentstore/tests/test_contentstore.py
@@ -42,6 +42,7 @@
from xmodule.seq_module import SequenceDescriptor
from xmodule.modulestore.exceptions import ItemNotFoundError
from xmodule.modulestore.locator import BlockUsageLocator
+from xmodule.tabs import CourseTabList
from contentstore.views.component import ADVANCED_COMPONENT_TYPES
from xmodule.exceptions import NotFoundError
@@ -395,6 +396,38 @@ def test_create_static_tab_and_rename(self):
self.assertEqual(course.tabs, expected_tabs)
+ def test_invalid_static_tab_on_import(self):
+ """
+ Test that on import, url_slug of static tabs changes to some unique hex string if that tab
+ has invalid url slug, e.g. 'static'
+ """
+ module_store = modulestore('direct')
+ import_from_xml(module_store, 'common/test/data/', ['2014_static_tabs'])
+
+ course_location = CourseDescriptor.id_to_location('Edx/StaticTabs/2014_static_tabs')
+ course = module_store.get_item(course_location)
+
+ self.assertIsNotNone(course)
+
+ # test that static tab is properly imported and its url_slug is not 'static'
+ static_tab = None
+ for tab in course.tabs:
+ if tab.type == u'static_tab' and tab.name == u'Sample Static Page':
+ static_tab = tab
+
+ self.assertIsNotNone(static_tab)
+ self.assertNotEqual(static_tab.url_slug, u'static')
+
+ expected_tabs = []
+ expected_tabs.append({u'type': u'courseware'})
+ expected_tabs.append({u'type': u'course_info', u'name': u'Course Info'})
+ expected_tabs.append({u'type': u'textbooks'})
+ expected_tabs.append({u'type': u'discussion', u'name': u'Discussion'})
+ expected_tabs.append({u'type': u'wiki', u'name': u'Wiki'})
+ expected_tabs.append({u'type': u'progress', u'name': u'Progress'})
+ expected_tabs.append({u'type': u'static_tab', u'name': u'Sample Static Page', u"url_slug": static_tab.url_slug})
+ self.assertEqual(course.tabs, expected_tabs)
+
def test_static_tab_reordering(self):
module_store, course_location, new_location = self._create_static_tabs()
diff --git a/common/lib/xmodule/xmodule/modulestore/xml.py b/common/lib/xmodule/xmodule/modulestore/xml.py
index 304f5f1c0c88..2ea22c412a6f 100644
--- a/common/lib/xmodule/xmodule/modulestore/xml.py
+++ b/common/lib/xmodule/xmodule/modulestore/xml.py
@@ -13,6 +13,7 @@
from importlib import import_module
from lxml import etree
from path import path
+from uuid import uuid4
from xmodule.error_module import ErrorDescriptor
from xmodule.errortracker import make_error_tracker, exc_info_to_str
@@ -38,6 +39,7 @@
log = logging.getLogger(__name__)
+INVALID_STATIC_TAB_SLUGS = ['static']
# VS[compat]
# TODO (cpennington): Remove this once all fall 2012 courses have been imported
@@ -651,6 +653,9 @@ def _load_extra_content(self, system, course_descriptor, category, content_path,
data_content = {'data': html, 'location': loc, 'category': category}
if module is None:
+ if category == 'static_tab' and slug in INVALID_STATIC_TAB_SLUGS:
+ loc = loc.replace(name = uuid4().hex)
+
module = system.construct_xblock(
category,
# We're loading a descriptor, so student_id is meaningless
@@ -665,6 +670,10 @@ def _load_extra_content(self, system, course_descriptor, category, content_path,
if category == "static_tab":
tab = CourseTabList.get_tab_by_slug(tab_list=course_descriptor.tabs, url_slug=slug)
if tab:
+ if slug in INVALID_STATIC_TAB_SLUGS:
+ # Modify url_slug according to location
+ setattr(tab, 'url_slug', loc.name)
+
module.display_name = tab.name
module.data_dir = course_dir
module.save()
diff --git a/common/test/data/2014_static_tabs/about/overview.html b/common/test/data/2014_static_tabs/about/overview.html
new file mode 100644
index 000000000000..33911ae1ee73
--- /dev/null
+++ b/common/test/data/2014_static_tabs/about/overview.html
@@ -0,0 +1,47 @@
+ Include your long course description here. The long course description should contain 150-400 words. This is paragraph 2 of the long course description. Add more paragraphs as needed. Make sure to enclose them in paragraph tags. Add information about course prerequisites here. Biography of instructor/staff member #1 Biography of instructor/staff member #2 No, a free online version of Chemistry: Principles, Patterns, and Applications, First Edition by Bruce Averill and Patricia Eldredge will be available, though you can purchase a printed version (published by FlatWorld Knowledge) if you’d like. Your answer would be displayed here.About This Course
+ Prerequisites
+ Course Staff
+
+ Staff Member #1
+
+ Staff Member #2
+ Frequently Asked Questions
+ Do I need to buy a textbook?
+ Question #2
+