make courses.html also honor the ENABLE_COURSE_DISCOVERY feature flag
This commit is contained in:
@@ -198,6 +198,52 @@ class IndexPageCourseCardsSortingTests(ModuleStoreTestCase):
|
||||
)
|
||||
self.factory = RequestFactory()
|
||||
|
||||
@patch('student.views.render_to_response', RENDER_MOCK)
|
||||
@patch('courseware.views.render_to_response', RENDER_MOCK)
|
||||
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False})
|
||||
def test_course_discovery_off(self):
|
||||
"""
|
||||
Asserts that the Course Discovery UI elements follow the
|
||||
feature flag settings
|
||||
"""
|
||||
response = self.client.get('/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
# assert that the course discovery UI is not present
|
||||
self.assertNotIn('Search for a course', response.content)
|
||||
|
||||
# check the /courses view
|
||||
response = self.client.get(reverse('branding.views.courses'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# assert that the course discovery UI is not present
|
||||
self.assertNotIn('Search for a course', response.content)
|
||||
self.assertNotIn('<aside aria-label="Refine your search" class="search-facets phone-menu">', response.content)
|
||||
|
||||
# make sure we have the special css class on the section
|
||||
self.assertIn('<section class="courses no-course-discovery">', response.content)
|
||||
|
||||
@patch('student.views.render_to_response', RENDER_MOCK)
|
||||
@patch('courseware.views.render_to_response', RENDER_MOCK)
|
||||
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': True})
|
||||
def test_course_discovery_on(self):
|
||||
"""
|
||||
Asserts that the Course Discovery UI elements follow the
|
||||
feature flag settings
|
||||
"""
|
||||
response = self.client.get('/')
|
||||
self.assertEqual(response.status_code, 200)
|
||||
# assert that the course discovery UI is not present
|
||||
self.assertIn('Search for a course', response.content)
|
||||
|
||||
# check the /courses view
|
||||
response = self.client.get(reverse('branding.views.courses'))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
# assert that the course discovery UI is not present
|
||||
self.assertIn('Search for a course', response.content)
|
||||
self.assertIn('<aside aria-label="Refine your search" class="search-facets phone-menu">', response.content)
|
||||
self.assertIn('<section class="courses">', response.content)
|
||||
|
||||
@patch('student.views.render_to_response', RENDER_MOCK)
|
||||
@patch('courseware.views.render_to_response', RENDER_MOCK)
|
||||
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_COURSE_DISCOVERY': False})
|
||||
|
||||
Reference in New Issue
Block a user