diff --git a/lms/djangoapps/courseware/tests/test_tabs.py b/lms/djangoapps/courseware/tests/test_tabs.py index c6157ac40e..58bc1908e8 100644 --- a/lms/djangoapps/courseware/tests/test_tabs.py +++ b/lms/djangoapps/courseware/tests/test_tabs.py @@ -2,7 +2,7 @@ Test cases for tabs. """ -import waffle +from waffle.testutils import override_flag from django.core.urlresolvers import reverse from django.http import Http404 @@ -781,10 +781,9 @@ class CourseInfoTabTestCase(TabTestCase): tabs = get_course_tab_list(self.request, self.course) self.assertEqual(tabs[0].type, 'course_info') - @patch('waffle.flag_is_active') - def test_default_tab_for_new_course_experience(self, patched_flag_is_active): + @override_flag(UNIFIED_COURSE_EXPERIENCE_FLAG, active=True) + def test_default_tab_for_new_course_experience(self): # Verify that the unified course experience hides the course info tab - patched_flag_is_active.return_value = True tabs = get_course_tab_list(self.request, self.course) self.assertEqual(tabs[0].type, 'courseware') diff --git a/lms/templates/courseware/info.html b/lms/templates/courseware/info.html index 2f438e297b..3ed50fb706 100644 --- a/lms/templates/courseware/info.html +++ b/lms/templates/courseware/info.html @@ -6,6 +6,7 @@ from datetime import datetime from pytz import timezone, utc +from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ from courseware.courses import get_course_info_section, get_course_date_blocks @@ -113,6 +114,13 @@ from openedx.core.djangolib.markup import HTML, Text
+

${_("Course Tools")}

+
+ + + ${_("Bookmarks")} + +
% if SelfPacedConfiguration.current().enable_course_home_improvements: ${HTML(dates_fragment.body_html())} diff --git a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html index 82972b9168..b76f3ee383 100644 --- a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html +++ b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html @@ -23,13 +23,7 @@ from openedx.features.course_experience import UNIFIED_COURSE_EXPERIENCE_FLAG
- % if waffle.flag_is_active(request, UNIFIED_COURSE_EXPERIENCE_FLAG): -
-
- ${HTML(outline_fragment.body_html())} -
-
-
- % else: - ${HTML(outline_fragment.body_html())} - % endif + % endif + +
diff --git a/openedx/features/course_experience/tests/views/test_course_home.py b/openedx/features/course_experience/tests/views/test_course_home.py index 82364e795b..f221e5d2aa 100644 --- a/openedx/features/course_experience/tests/views/test_course_home.py +++ b/openedx/features/course_experience/tests/views/test_course_home.py @@ -1,6 +1,9 @@ """ Tests for the course home page. """ + +from waffle.testutils import override_flag + from django.core.urlresolvers import reverse from openedx.core.djangoapps.content.block_structure.api import get_course_in_cache @@ -10,6 +13,8 @@ from xmodule.modulestore import ModuleStoreEnum from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory, ItemFactory, check_mongo_calls +from openedx.features.course_experience import UNIFIED_COURSE_EXPERIENCE_FLAG + TEST_PASSWORD = 'test' @@ -36,7 +41,7 @@ class TestCourseHomePage(SharedModuleStoreTestCase): # pylint: disable=super-method-not-called with super(TestCourseHomePage, cls).setUpClassAndTestData(): with cls.store.default_store(ModuleStoreEnum.Type.split): - cls.course = CourseFactory.create() + cls.course = CourseFactory.create(org='edX', number='test', display_name='Test Course') with cls.store.bulk_operations(cls.course.id): chapter = ItemFactory.create(category='chapter', parent_location=cls.course.location) section = ItemFactory.create(category='sequential', parent_location=chapter.location) @@ -57,6 +62,15 @@ class TestCourseHomePage(SharedModuleStoreTestCase): super(TestCourseHomePage, self).setUp() self.client.login(username=self.user.username, password=TEST_PASSWORD) + @override_flag(UNIFIED_COURSE_EXPERIENCE_FLAG, active=True) + def test_unified_page(self): + """ + Verify the rendering of the unified page. + """ + url = course_home_url(self.course) + response = self.client.get(url) + self.assertContains(response, '

Test Course

') + def test_queries(self): """ Verify that the view's query count doesn't regress. @@ -65,7 +79,7 @@ class TestCourseHomePage(SharedModuleStoreTestCase): get_course_in_cache(self.course.id) # Fetch the view and verify the query counts - with self.assertNumQueries(37): + with self.assertNumQueries(35): with check_mongo_calls(3): url = course_home_url(self.course) self.client.get(url) diff --git a/openedx/features/course_experience/views/course_home.py b/openedx/features/course_experience/views/course_home.py index 9ed7c96a5f..9a5d27b05f 100644 --- a/openedx/features/course_experience/views/course_home.py +++ b/openedx/features/course_experience/views/course_home.py @@ -96,14 +96,16 @@ class CourseHomeFragmentView(EdxFragmentView): # Render the course dates as a fragment dates_fragment = CourseDatesFragmentView().render_to_fragment(request, course_id=course_id, **kwargs) - # Get the handouts # TODO: Use get_course_overview_with_access and blocks api course = get_course_with_access(request.user, 'load', course_key, check_if_enrolled=True) + + # Get the handouts handouts_html = get_course_info_section(request, request.user, course, 'handouts') # Render the course home fragment context = { 'csrf': csrf(request)['csrf_token'], + 'course': course, 'course_key': course_key, 'course': course, 'outline_fragment': outline_fragment,