diff --git a/cms/djangoapps/contentstore/tests/tests.py b/cms/djangoapps/contentstore/tests/tests.py index bfdcfe1438..fd811fb101 100644 --- a/cms/djangoapps/contentstore/tests/tests.py +++ b/cms/djangoapps/contentstore/tests/tests.py @@ -353,27 +353,26 @@ class ContentStoreTest(TestCase): def test_static_tab_reordering(self): import_from_xml(modulestore(), 'common/test/data/', ['full']) - # reverse the ordering - tabs = { 'tabs' : ['i4x://edX/full/static_tab/resources', 'i4x://edX/full/static_tab/syllabus'] } - resp = self.client.post(reverse('reorder_tabs'), json.dumps(tabs), "application/json") - ms = modulestore('direct') + course = ms.get_item(Location(['i4x','edX','full','course','6.002_Spring_2012', None])) + + # reverse the ordering + reverse_tabs = [] + for tab in course.tabs: + if tab['type'] == 'static_tab': + reverse_tabs.insert(0, 'i4x://edX/full/static_tab/{0}'.format(tab['url_slug'])) + + resp = self.client.post(reverse('reorder_tabs'), json.dumps({'tabs':reverse_tabs}), "application/json") + course = ms.get_item(Location(['i4x','edX','full','course','6.002_Spring_2012', None])) # compare to make sure that the tabs information is in the expected order after the server call - resource_idx = 0 - syllabus_idx = 0 - idx = 0 + course_tabs = [] for tab in course.tabs: if tab['type'] == 'static_tab': - if tab['url_slug'] == 'resources': - resource_idx = idx - elif tab['url_slug'] == 'syllabus': - syllabus_idx = idx - idx+=1 - - self.assertLess(resource_idx, syllabus_idx) + course_tabs.append('i4x://edX/full/static_tab/{0}'.format(tab['url_slug'])) + self.assertEqual(reverse_tabs, course_tabs)