From e1d8347c211e185a00d00d16f1657bb9301d3d3f Mon Sep 17 00:00:00 2001 From: John Eskew Date: Thu, 21 Apr 2016 14:39:29 -0400 Subject: [PATCH] Fix static tabs test. --- common/lib/xmodule/xmodule/modulestore/tests/factories.py | 1 - lms/djangoapps/courseware/tests/test_tabs.py | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/modulestore/tests/factories.py b/common/lib/xmodule/xmodule/modulestore/tests/factories.py index 66e4ea081d..c7f6e91e68 100644 --- a/common/lib/xmodule/xmodule/modulestore/tests/factories.py +++ b/common/lib/xmodule/xmodule/modulestore/tests/factories.py @@ -234,7 +234,6 @@ class ToyCourseFactory(SampleCourseFactory): user_id, toy_course.id, "course_info", "handouts", fields={"data": "Sample"} ) - ## TODO: Broken! These static tabs are never added to course.tabs? store.create_item( user_id, toy_course.id, "static_tab", "resources", fields={"display_name": "Resources"}, diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index f11d7c12d1..f7105cb3d6 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -241,7 +241,6 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, SharedModuleStoreTestCase): ) cls.course.tabs.append(xmodule_tabs.CourseTab.load('static_tab', name='New Tab', url_slug='new_tab')) cls.course.save() - cls.toy_course_key = SlashSeparatedCourseKey('edX', 'toy', '2012_Fall') def test_logged_in(self): self.setup_user() @@ -262,16 +261,15 @@ class StaticTabDateTestCase(LoginEnrollmentTestCase, SharedModuleStoreTestCase): with self.assertRaises(Http404): static_tab(request, course_id='edX/toy', tab_slug='new_tab') - @skip("Broken! Never finds the 'resources' static tab when created by the ToyCourseFactory.") def test_get_static_tab_contents(self): self.setup_user() - course = get_course_by_id(self.toy_course_key) + course = get_course_by_id(self.course.id) request = get_request_for_user(self.user) - tab = xmodule_tabs.CourseTabList.get_tab_by_slug(course.tabs, 'resources') + tab = xmodule_tabs.CourseTabList.get_tab_by_slug(course.tabs, 'new_tab') # Test render works okay tab_content = get_static_tab_contents(request, course, tab) - self.assertIn(self.toy_course_key.to_deprecated_string(), tab_content) + self.assertIn(self.course.id.to_deprecated_string(), tab_content) self.assertIn('static_tab', tab_content) # Test when render raises an exception