Commit 1b774d15 by ayub-khan

-Allow staff to preview certificates before course end

parent 3fc45dcd
...@@ -658,7 +658,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase): ...@@ -658,7 +658,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
self.assertIn("We cannot find a certificate with this URL or ID number.", response.content) self.assertIn("We cannot find a certificate with this URL or ID number.", response.content)
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED) @override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
def test_html_view_for_non_viewable_certificate(self): def test_html_view_for_non_viewable_certificate_and_for_student_user(self):
""" """
Tests that Certificate HTML Web View returns "Cannot Find Certificate" if certificate is not viewable yet. Tests that Certificate HTML Web View returns "Cannot Find Certificate" if certificate is not viewable yet.
""" """
......
...@@ -350,7 +350,7 @@ def _get_user_certificate(request, user, course_key, course, preview_mode=None): ...@@ -350,7 +350,7 @@ def _get_user_certificate(request, user, course_key, course, preview_mode=None):
verify_uuid=unicode(uuid4().hex), verify_uuid=unicode(uuid4().hex),
modified_date=modified_date modified_date=modified_date
) )
else: elif certificates_viewable_for_course(course):
# certificate is being viewed by learner or public # certificate is being viewed by learner or public
try: try:
user_certificate = GeneratedCertificate.eligible_certificates.get( user_certificate = GeneratedCertificate.eligible_certificates.get(
...@@ -516,13 +516,6 @@ def render_html_view(request, user_id, course_id): ...@@ -516,13 +516,6 @@ def render_html_view(request, user_id, course_id):
log.info(error_str, course_id, user_id, str(exception)) log.info(error_str, course_id, user_id, str(exception))
return _render_invalid_certificate(course_id, platform_name, configuration) return _render_invalid_certificate(course_id, platform_name, configuration)
if not certificates_viewable_for_course(course):
log.info(
"Invalid cert: Certificate for %s is not viewable yet.",
course_id,
)
return _render_invalid_certificate(course_id, platform_name, configuration)
# Kick the user back to the "Invalid" screen if the feature is disabled for the course # Kick the user back to the "Invalid" screen if the feature is disabled for the course
if not course.cert_html_view_enabled: if not course.cert_html_view_enabled:
log.info( log.info(
......
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