diff --git a/common/djangoapps/course_modes/models.py b/common/djangoapps/course_modes/models.py index db6ff974f3..d76823e9bb 100644 --- a/common/djangoapps/course_modes/models.py +++ b/common/djangoapps/course_modes/models.py @@ -100,6 +100,9 @@ class CourseMode(models.Model): # Modes that allow a student to pursue a verified certificate VERIFIED_MODES = [VERIFIED, PROFESSIONAL] + # Modes that allow a student to pursue a non-verified certificate + NON_VERIFIED_MODES = [HONOR, AUDIT, NO_ID_PROFESSIONAL_MODE] + # Modes that allow a student to earn credit with a university partner CREDIT_MODES = [CREDIT_MODE] diff --git a/common/djangoapps/student/tests/test_certificates.py b/common/djangoapps/student/tests/test_certificates.py index 539dc456b9..af4a6db8f1 100644 --- a/common/djangoapps/student/tests/test_certificates.py +++ b/common/djangoapps/student/tests/test_certificates.py @@ -13,6 +13,7 @@ from xmodule.modulestore.tests.factories import CourseFactory from student.tests.factories import UserFactory, CourseEnrollmentFactory from certificates.tests.factories import GeneratedCertificateFactory # pylint: disable=import-error from certificates.api import get_certificate_url # pylint: disable=import-error +from course_modes.models import CourseMode # pylint: disable=no-member @@ -42,6 +43,15 @@ class CertificateDisplayTest(ModuleStoreTestCase): self._create_certificate(enrollment_mode) self._check_can_download_certificate() + @patch.dict('django.conf.settings.FEATURES', {'CERTIFICATES_HTML_VIEW': False}) + def test_display_verified_certificate_no_id(self): + """ + Confirm that if we get a certificate with a no-id-professional mode + we still can download our certificate + """ + self._create_certificate(CourseMode.NO_ID_PROFESSIONAL_MODE) + self._check_can_download_certificate_no_id() + @ddt.data('verified', 'honor') @override_settings(CERT_NAME_SHORT='Test_Certificate') @patch.dict('django.conf.settings.FEATURES', {'CERTIFICATES_HTML_VIEW': True}) @@ -105,6 +115,16 @@ class CertificateDisplayTest(ModuleStoreTestCase): self.assertContains(response, u'Download Your ID Verified') self.assertContains(response, self.DOWNLOAD_URL) + def _check_can_download_certificate_no_id(self): + """ + Inspects the dashboard to see if a certificate for a non verified course enrollment + is present + """ + response = self.client.get(reverse('dashboard')) + self.assertContains(response, u'Download') + self.assertContains(response, u'(PDF)') + self.assertContains(response, self.DOWNLOAD_URL) + def _check_can_not_download_certificate(self): """ Make sure response does not have any of the download certificate buttons diff --git a/lms/templates/dashboard/_dashboard_certificate_information.html b/lms/templates/dashboard/_dashboard_certificate_information.html index 034fcfde1e..4d75650a81 100644 --- a/lms/templates/dashboard/_dashboard_certificate_information.html +++ b/lms/templates/dashboard/_dashboard_certificate_information.html @@ -59,7 +59,7 @@ else: ${_("View {cert_name_short}").format(cert_name_short=cert_name_short,)} - % elif cert_status['show_download_url'] and (enrollment.mode == 'honor' or enrollment.mode == 'audit'): + % elif cert_status['show_download_url'] and enrollment.mode in CourseMode.NON_VERIFIED_MODES: