Unverified Commit 571be1f5 by Ayub khan Committed by GitHub

Merge pull request #16779 from edx/LEARNER-3399

Learner-3399 fix for certificates
parents dd78ea59 1b774d15
......@@ -658,7 +658,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
self.assertIn("We cannot find a certificate with this URL or ID number.", response.content)
@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.
"""
......
......@@ -350,7 +350,7 @@ def _get_user_certificate(request, user, course_key, course, preview_mode=None):
verify_uuid=unicode(uuid4().hex),
modified_date=modified_date
)
else:
elif certificates_viewable_for_course(course):
# certificate is being viewed by learner or public
try:
user_certificate = GeneratedCertificate.eligible_certificates.get(
......@@ -516,13 +516,6 @@ def render_html_view(request, user_id, course_id):
log.info(error_str, course_id, user_id, str(exception))
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
if not course.cert_html_view_enabled:
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