Commit 478f3cc8 by cahrens

Persist static_tab name.

STUD-663.
parent 424570c6
......@@ -120,8 +120,30 @@ class TestMongoModuleStore(object):
'{0} is a template course'.format(course)
)
def test_static_tab_names(self):
courses = self.store.get_courses()
def get_tab_name(index):
"""
Helper function for pulling out the name of a given static tab.
Assumes the information is desired for courses[1] ('toy' course).
"""
return courses[1].tabs[index]['name']
# There was a bug where model.save was not getting called after the static tab name
# was set set for tabs that have a URL slug. 'Syllabus' and 'Resources' fall into that
# category, but for completeness, I'm also testing 'Course Info' and 'Discussion' (no url slug).
assert_equals('Course Info', get_tab_name(1))
assert_equals('Syllabus', get_tab_name(2))
assert_equals('Resources', get_tab_name(3))
assert_equals('Discussion', get_tab_name(4))
class TestMongoKeyValueStore(object):
"""
Tests for MongoKeyValueStore.
"""
def setUp(self):
self.data = {'foo': 'foo_value'}
......@@ -131,6 +153,9 @@ class TestMongoKeyValueStore(object):
self.kvs = MongoKeyValueStore(self.data, self.children, self.metadata, self.location, 'category')
def _check_read(self, key, expected_value):
"""
Asserts the get and has methods.
"""
assert_equals(expected_value, self.kvs.get(key))
assert self.kvs.has(key)
......
......@@ -479,6 +479,7 @@ class XMLModuleStore(ModuleStoreBase):
if tab.get('url_slug') == slug:
module.display_name = tab['name']
module.data_dir = course_dir
module.save()
self.modules[course_descriptor.id][module.location] = module
except Exception, e:
logging.exception("Failed to load {0}. Skipping... Exception: {1}".format(filepath, str(e)))
......
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