Commit f7b5066b by Diana Huang

Only show 'Explore New Courses' button when courses are browsable.

parent 990a8cbf
...@@ -71,12 +71,14 @@ from openedx.core.djangolib.markup import HTML, Text ...@@ -71,12 +71,14 @@ from openedx.core.djangolib.markup import HTML, Text
% elif own_profile: % elif own_profile:
<div class="learner-message"> <div class="learner-message">
<h4 class="message-header">${_("You haven't earned any certificates yet.")}</h4> <h4 class="message-header">${_("You haven't earned any certificates yet.")}</h4>
<p class="message-actions"> % if settings.FEATURES.get('COURSES_ARE_BROWSABLE'):
<a class="btn btn-brand" href="${marketing_link('COURSES')}"> <p class="message-actions">
<span class="icon fa fa-search" aria-hidden="true"></span> <a class="btn btn-brand" href="${marketing_link('COURSES')}">
${_('Explore New Courses')} <span class="icon fa fa-search" aria-hidden="true"></span>
</a> ${_('Explore New Courses')}
</p> </a>
</p>
% endif
</div> </div>
% endif % endif
% endif % endif
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import datetime import datetime
import ddt import ddt
import mock
from certificates.tests.factories import GeneratedCertificateFactory # pylint: disable=import-error from certificates.tests.factories import GeneratedCertificateFactory # pylint: disable=import-error
from course_modes.models import CourseMode from course_modes.models import CourseMode
...@@ -197,3 +198,13 @@ class LearnerProfileViewTest(UrlResetMixin, ModuleStoreTestCase): ...@@ -197,3 +198,13 @@ class LearnerProfileViewTest(UrlResetMixin, ModuleStoreTestCase):
self.assertContains(response, 'You haven&#39;t earned any certificates yet.') self.assertContains(response, 'You haven&#39;t earned any certificates yet.')
else: else:
self.assertNotContains(response, 'You haven&#39;t earned any certificates yet.') self.assertNotContains(response, 'You haven&#39;t earned any certificates yet.')
@ddt.data(True, False)
@override_waffle_flag(SHOW_ACHIEVEMENTS_FLAG, active=True)
def test_explore_courses_visibility(self, courses_browsable):
with mock.patch.dict('django.conf.settings.FEATURES', {'COURSES_ARE_BROWSABLE': courses_browsable}):
response = self.client.get('/u/{username}'.format(username=self.user.username))
if courses_browsable:
self.assertContains(response, 'Explore New Courses')
else:
self.assertNotContains(response, 'Explore New Courses')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment