New course cannot be started till web certificate is active

fixed broken test

changes based on feedback on 6/24

fixed broken unit test after feedback changes

added more checks and updated tests

fixed broken bok choy test

Fixed pylint quality error

trying to fix pylint quality error
This commit is contained in:
Zia Fazal
2015-06-24 14:40:52 +05:00
parent 614bcafb7c
commit bcbd1464d4
17 changed files with 142 additions and 17 deletions

View File

@@ -47,9 +47,14 @@ class CertificateDisplayTest(ModuleStoreTestCase):
@patch.dict('django.conf.settings.FEATURES', {'CERTIFICATES_HTML_VIEW': True})
def test_display_download_certificate_button(self, enrollment_mode):
"""
Tests if CERTIFICATES_HTML_VIEW is True and there is no active certificate configuration available
Tests if CERTIFICATES_HTML_VIEW is True
and course has enabled web certificates via cert_html_view_enabled setting
and no active certificate configuration available
then any of the Download certificate button should not be visible.
"""
self.course.cert_html_view_enabled = True
self.course.save()
self.store.update_item(self.course, self.user.id)
self._create_certificate(enrollment_mode)
self._check_can_not_download_certificate()
@@ -75,6 +80,7 @@ class CertificateDisplayTest(ModuleStoreTestCase):
}
]
self.course.certificates = {'certificates': certificates}
self.course.cert_html_view_enabled = True
self.course.save() # pylint: disable=no-member
self.store.update_item(self.course, self.user.id)

View File

@@ -59,7 +59,11 @@ from student.forms import AccountCreationForm, PasswordResetFormNoActive
from verify_student.models import SoftwareSecurePhotoVerification # pylint: disable=import-error
from certificates.models import CertificateStatuses, certificate_status_for_student
from certificates.api import get_certificate_url, get_active_web_certificate # pylint: disable=import-error
from certificates.api import ( # pylint: disable=import-error
get_certificate_url,
get_active_web_certificate,
has_html_certificates_enabled,
)
from dark_lang.models import DarkLangConfig
from xmodule.modulestore.django import modulestore
@@ -305,7 +309,7 @@ def _cert_info(user, course, cert_status, course_mode):
if status == 'ready':
# showing the certificate web view button if certificate is ready state and feature flags are enabled.
if settings.FEATURES.get('CERTIFICATES_HTML_VIEW', False):
if has_html_certificates_enabled(course.id, course):
if get_active_web_certificate(course) is not None:
certificate_url = get_certificate_url(
user_id=user.id,