Modify certificates_show_before_end_date behavior
Hide the certificate notification box when there's no certificate information, even when the flag certificates_show_before_end_date is turned on. ECOM-11
This commit is contained in:
@@ -54,7 +54,7 @@ class CourseEndingTest(TestCase):
|
||||
def test_cert_info(self):
|
||||
user = Mock(username="fred")
|
||||
survey_url = "http://a_survey.com"
|
||||
course = Mock(end_of_course_survey_url=survey_url)
|
||||
course = Mock(end_of_course_survey_url=survey_url, certificates_show_before_end=False)
|
||||
|
||||
self.assertEqual(_cert_info(user, course, None),
|
||||
{'status': 'processing',
|
||||
@@ -133,6 +133,22 @@ class CourseEndingTest(TestCase):
|
||||
'mode': 'honor'
|
||||
})
|
||||
|
||||
# test when the status is true, we get the correct results out
|
||||
course2.certificates_show_before_end = True
|
||||
cert_status = {'status': 'unavailable'}
|
||||
self.assertIsNone(_cert_info(user, course2, cert_status))
|
||||
|
||||
cert_status = {'status': 'notpassing', 'grade': '67',
|
||||
'download_url': download_url, 'mode': 'honor'}
|
||||
self.assertEqual(_cert_info(user, course2, cert_status),
|
||||
{'status': 'notpassing',
|
||||
'show_disabled_download_button': False,
|
||||
'show_download_url': False,
|
||||
'show_survey_button': False,
|
||||
'grade': '67',
|
||||
'mode': 'honor'
|
||||
})
|
||||
|
||||
|
||||
@override_settings(MODULESTORE=TEST_DATA_MIXED_MODULESTORE)
|
||||
class DashboardTest(TestCase):
|
||||
|
||||
@@ -285,6 +285,9 @@ def _cert_info(user, course, cert_status):
|
||||
if cert_status is None:
|
||||
return default_info
|
||||
|
||||
if cert_status['status'] == 'unavailable' and course.certificates_show_before_end:
|
||||
return None
|
||||
|
||||
status = template_state.get(cert_status['status'], default_status)
|
||||
|
||||
d = {'status': status,
|
||||
|
||||
Reference in New Issue
Block a user