From e47c97b465930f5e23ab2ec8540033df1fbfeccd Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Sun, 7 Jun 2015 17:43:10 -0400 Subject: [PATCH] make courses.html also honor the ENABLE_COURSE_DISCOVERY feature flag --- lms/djangoapps/branding/tests/test_page.py | 46 +++++++++++++ lms/envs/bok_choy.env.json | 3 +- lms/envs/bok_choy.py | 3 + lms/static/sass/multicourse/_courses.scss | 78 ++++++++++++++++------ lms/templates/courseware/courses.html | 8 ++- 5 files changed, 116 insertions(+), 22 deletions(-) diff --git a/lms/djangoapps/branding/tests/test_page.py b/lms/djangoapps/branding/tests/test_page.py index 199784da06..ac4357e4f0 100644 --- a/lms/djangoapps/branding/tests/test_page.py +++ b/lms/djangoapps/branding/tests/test_page.py @@ -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('