diff --git a/lms/djangoapps/ccx/tests/test_field_override_performance.py b/lms/djangoapps/ccx/tests/test_field_override_performance.py index aedcab4313..4919e762ff 100644 --- a/lms/djangoapps/ccx/tests/test_field_override_performance.py +++ b/lms/djangoapps/ccx/tests/test_field_override_performance.py @@ -231,18 +231,18 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase): # # of sql queries to default, # # of mongo queries, # ) - ('no_overrides', 1, True, False): (21, 6), - ('no_overrides', 2, True, False): (21, 6), - ('no_overrides', 3, True, False): (21, 6), - ('ccx', 1, True, False): (21, 6), - ('ccx', 2, True, False): (21, 6), - ('ccx', 3, True, False): (21, 6), - ('no_overrides', 1, False, False): (21, 6), - ('no_overrides', 2, False, False): (21, 6), - ('no_overrides', 3, False, False): (21, 6), - ('ccx', 1, False, False): (21, 6), - ('ccx', 2, False, False): (21, 6), - ('ccx', 3, False, False): (21, 6), + ('no_overrides', 1, True, False): (22, 6), + ('no_overrides', 2, True, False): (22, 6), + ('no_overrides', 3, True, False): (22, 6), + ('ccx', 1, True, False): (22, 6), + ('ccx', 2, True, False): (22, 6), + ('ccx', 3, True, False): (22, 6), + ('no_overrides', 1, False, False): (22, 6), + ('no_overrides', 2, False, False): (22, 6), + ('no_overrides', 3, False, False): (22, 6), + ('ccx', 1, False, False): (22, 6), + ('ccx', 2, False, False): (22, 6), + ('ccx', 3, False, False): (22, 6), } @@ -254,19 +254,19 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase): __test__ = True TEST_DATA = { - ('no_overrides', 1, True, False): (21, 3), - ('no_overrides', 2, True, False): (21, 3), - ('no_overrides', 3, True, False): (21, 3), - ('ccx', 1, True, False): (21, 3), - ('ccx', 2, True, False): (21, 3), - ('ccx', 3, True, False): (21, 3), - ('ccx', 1, True, True): (22, 3), - ('ccx', 2, True, True): (22, 3), - ('ccx', 3, True, True): (22, 3), - ('no_overrides', 1, False, False): (21, 3), - ('no_overrides', 2, False, False): (21, 3), - ('no_overrides', 3, False, False): (21, 3), - ('ccx', 1, False, False): (21, 3), - ('ccx', 2, False, False): (21, 3), - ('ccx', 3, False, False): (21, 3), + ('no_overrides', 1, True, False): (22, 3), + ('no_overrides', 2, True, False): (22, 3), + ('no_overrides', 3, True, False): (22, 3), + ('ccx', 1, True, False): (22, 3), + ('ccx', 2, True, False): (22, 3), + ('ccx', 3, True, False): (22, 3), + ('ccx', 1, True, True): (23, 3), + ('ccx', 2, True, True): (23, 3), + ('ccx', 3, True, True): (23, 3), + ('no_overrides', 1, False, False): (22, 3), + ('no_overrides', 2, False, False): (22, 3), + ('no_overrides', 3, False, False): (22, 3), + ('ccx', 1, False, False): (22, 3), + ('ccx', 2, False, False): (22, 3), + ('ccx', 3, False, False): (22, 3), } diff --git a/lms/djangoapps/courseware/static_tab.html b/lms/djangoapps/courseware/static_tab.html deleted file mode 100644 index 3d977bc017..0000000000 --- a/lms/djangoapps/courseware/static_tab.html +++ /dev/null @@ -1,33 +0,0 @@ -## mako - -<%page expression_filter="h"/> -<%! -from openedx.core.djangolib.markup import HTML -%> - -<%inherit file="/main.html" /> -<%block name="bodyclass">view-in-course view-statictab ${course.css_class or ''} -<%namespace name='static' file='/static_content.html'/> - -<%block name="headextra"> -<%static:css group='style-course-vendor'/> -<%static:css group='style-course'/> -${HTML(fragment.head_html())} - -<%block name="js_extra"> - -<%include file="/mathjax_include.html" args="disable_fast_preview=True"/> -${HTML(fragment.foot_html())} - - -<%block name="pagetitle">${tab['name']} | ${course.display_number_with_default} - -<%include file="/courseware/course_navigation.html" args="active_page=active_page" /> - -
-
-
- ${HTML(fragment.body_html())} -
-
-
diff --git a/lms/djangoapps/courseware/tests/test_course_outline_views.py b/lms/djangoapps/courseware/tests/test_course_outline_views.py new file mode 100644 index 0000000000..c57c0a683d --- /dev/null +++ b/lms/djangoapps/courseware/tests/test_course_outline_views.py @@ -0,0 +1,72 @@ +""" +Tests for the Course Outline view and supporting views. +""" +from django.core.urlresolvers import reverse + +from student.models import CourseEnrollment +from student.tests.factories import UserFactory + +from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase +from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory + + +class TestCourseOutlinePage(SharedModuleStoreTestCase): + """ + Test the new course outline view. + """ + @classmethod + def setUpClass(cls): + """Set up the simplest course possible.""" + # setUpClassAndTestData() already calls setUpClass on SharedModuleStoreTestCase + # pylint: disable=super-method-not-called + with super(TestCourseOutlinePage, cls).setUpClassAndTestData(): + cls.courses = [] + course = CourseFactory.create() + with cls.store.bulk_operations(course.id): + chapter = ItemFactory.create(category='chapter', parent_location=course.location) + section = ItemFactory.create(category='sequential', parent_location=chapter.location) + ItemFactory.create(category='vertical', parent_location=section.location) + + cls.courses.append(course) + + course = CourseFactory.create() + with cls.store.bulk_operations(course.id): + chapter = ItemFactory.create(category='chapter', parent_location=course.location) + section = ItemFactory.create(category='sequential', parent_location=chapter.location) + section2 = ItemFactory.create(category='sequential', parent_location=chapter.location) + ItemFactory.create(category='vertical', parent_location=section.location) + ItemFactory.create(category='vertical', parent_location=section2.location) + + @classmethod + def setUpTestData(cls): + """Set up and enroll our fake user in the course.""" + cls.password = 'test' + cls.user = UserFactory(password=cls.password) + for course in cls.courses: + CourseEnrollment.enroll(cls.user, course.id) + + def setUp(self): + """ + Set up for the tests. + """ + super(TestCourseOutlinePage, self).setUp() + self.client.login(username=self.user.username, password=self.password) + + def test_render(self): + for course in self.courses: + url = reverse( + 'unified_course_view', + kwargs={ + 'course_id': unicode(course.id), + } + ) + response = self.client.get(url) + self.assertEqual(response.status_code, 200) + response_content = response.content.decode("utf-8") + + for chapter in course.children: + self.assertIn(chapter.display_name, response_content) + for section in chapter.children: + self.assertIn(section.display_name, response_content) + for vertical in section.children: + self.assertNotIn(vertical.display_name, response_content) diff --git a/lms/djangoapps/courseware/tests/test_views.py b/lms/djangoapps/courseware/tests/test_views.py index 5bfd709857..63c93c751a 100644 --- a/lms/djangoapps/courseware/tests/test_views.py +++ b/lms/djangoapps/courseware/tests/test_views.py @@ -1419,17 +1419,17 @@ class ProgressPageTests(ModuleStoreTestCase): """Test that query counts remain the same for self-paced and instructor-paced courses.""" SelfPacedConfiguration(enabled=self_paced_enabled).save() self.setup_course(self_paced=self_paced) - with self.assertNumQueries(38), check_mongo_calls(4): + with self.assertNumQueries(39), check_mongo_calls(4): self._get_progress_page() def test_progress_queries(self): self.setup_course() - with self.assertNumQueries(38), check_mongo_calls(4): + with self.assertNumQueries(39), check_mongo_calls(4): self._get_progress_page() # subsequent accesses to the progress page require fewer queries. for _ in range(2): - with self.assertNumQueries(24), check_mongo_calls(4): + with self.assertNumQueries(25), check_mongo_calls(4): self._get_progress_page() @patch( diff --git a/lms/djangoapps/courseware/views/views.py b/lms/djangoapps/courseware/views/views.py index adb8659f9d..403906df79 100644 --- a/lms/djangoapps/courseware/views/views.py +++ b/lms/djangoapps/courseware/views/views.py @@ -1647,7 +1647,7 @@ class UnifiedCourseView(View): course = get_course_with_access(request.user, 'load', course_key, check_if_enrolled=True) # Render the outline as a fragment - outline_fragment = CourseOutlineFragmentView().render_fragment(request, course_id=course_id) + outline_fragment = CourseOutlineFragmentView().render_to_fragment(request, course_id=course_id) # Render the entire unified course view context = { @@ -1680,7 +1680,7 @@ class CourseOutlineFragmentView(FragmentView): return block - def render_fragment(self, request, course_id=None, **kwargs): + def render_to_fragment(self, request, course_id=None, **kwargs): """ Renders the course outline as a fragment. """ diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 8cbb0b4083..b530997765 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -111,9 +111,7 @@ django-ratelimit-backend==1.0 unicodecsv==0.9.4 django-require==1.0.11 pyuca==1.1 -web-fragments==0.1.0 wrapt==1.10.5 -XBlock==0.4.14 zendesk==1.1.1 # This needs to be installed *after* Cython, which is in pre.txt