@@ -229,7 +229,7 @@ def generate_user_certificates(student, course_key, course=None, insecure=False,
|
||||
log.info(message.format(user=student.id, course=course_key))
|
||||
|
||||
# If cert_status is not present in certificate valid_statuses (for example unverified) then
|
||||
# add_cert returns None and raises AttributeError while accesing cert attributes.
|
||||
# add_cert returns None and raises AttributeError while accessing cert attributes.
|
||||
if cert is None:
|
||||
return
|
||||
|
||||
@@ -356,7 +356,7 @@ def set_cert_generation_enabled(course_key, is_enabled):
|
||||
certificates for this course.
|
||||
|
||||
"""
|
||||
CertificateGenerationCourseSetting.set_self_generatation_enabled_for_course(course_key, is_enabled)
|
||||
CertificateGenerationCourseSetting.set_self_generation_enabled_for_course(course_key, is_enabled)
|
||||
cert_event_type = 'enabled' if is_enabled else 'disabled'
|
||||
event_name = '.'.join(['edx', 'certificate', 'generation', cert_event_type])
|
||||
tracker.emit(event_name, {
|
||||
|
||||
@@ -291,7 +291,7 @@ class GeneratedCertificate(models.Model):
|
||||
error_reason = models.CharField(max_length=512, blank=True, default='')
|
||||
|
||||
# This is necessary because CMS does not install the certificates app, but it
|
||||
# imports this models code. Simple History will attempt to connect to the installed
|
||||
# imports this model's code. Simple History will attempt to connect to the installed
|
||||
# model in the certificates app, which will fail.
|
||||
if 'certificates' in apps.app_configs:
|
||||
history = HistoricalRecords()
|
||||
@@ -319,7 +319,7 @@ class GeneratedCertificate(models.Model):
|
||||
Return a set of CourseKeys for which the user has certificates.
|
||||
|
||||
Sometimes we just want to check if a user has already been issued a
|
||||
certificate for a given course (e.g. to test refund elibigility).
|
||||
certificate for a given course (e.g. to test refund eligibility).
|
||||
Instead of checking if `certificate_for_student` returns `None` on each
|
||||
course_id individually, we instead just return a set of all CourseKeys
|
||||
for which this student has certificates all at once.
|
||||
@@ -874,7 +874,7 @@ class ExampleCertificate(TimeStampedModel):
|
||||
|
||||
This will usually be called either:
|
||||
1) When an error occurs adding the certificate to the queue.
|
||||
2) When we receieve a response from the queue (either error or success).
|
||||
2) When we receive a response from the queue (either error or success).
|
||||
|
||||
If an error occurs, we store the error message;
|
||||
if certificate generation is successful, we store the URL
|
||||
@@ -1014,7 +1014,7 @@ class CertificateGenerationCourseSetting(TimeStampedModel):
|
||||
return latest.self_generation_enabled
|
||||
|
||||
@classmethod
|
||||
def set_self_generatation_enabled_for_course(cls, course_key, is_enabled):
|
||||
def set_self_generation_enabled_for_course(cls, course_key, is_enabled):
|
||||
"""Enable or disable self-generated certificates for a course.
|
||||
|
||||
Arguments:
|
||||
|
||||
@@ -39,7 +39,7 @@ def _update_cert_settings_on_pacing_change(sender, updated_course_overview, **kw
|
||||
Catches the signal that course pacing has changed and enable/disable
|
||||
the self-generated certificates according to course-pacing.
|
||||
"""
|
||||
CertificateGenerationCourseSetting.set_self_generatation_enabled_for_course(
|
||||
CertificateGenerationCourseSetting.set_self_generation_enabled_for_course(
|
||||
updated_course_overview.id,
|
||||
updated_course_overview.self_paced,
|
||||
)
|
||||
|
||||
@@ -232,11 +232,11 @@ class CertificateDownloadableStatusTests(WebCertificateTestMixin, ModuleStoreTes
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class CertificateisInvalid(WebCertificateTestMixin, ModuleStoreTestCase):
|
||||
class CertificateIsInvalid(WebCertificateTestMixin, ModuleStoreTestCase):
|
||||
"""Tests for the `is_certificate_invalid` helper function. """
|
||||
|
||||
def setUp(self):
|
||||
super(CertificateisInvalid, self).setUp()
|
||||
super().setUp()
|
||||
|
||||
self.student = UserFactory()
|
||||
self.course = CourseFactory.create(
|
||||
|
||||
@@ -294,11 +294,11 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
|
||||
|
||||
def test_regen_cert_with_pdf_certificate(self):
|
||||
"""
|
||||
Test that regenerating PDF certifcate log warning message and certificate
|
||||
Test that regenerating a PDF certificate logs a warning message and the certificate
|
||||
status remains unchanged.
|
||||
"""
|
||||
download_url = 'http://www.example.com/certificate.pdf'
|
||||
# Create an existing verifed enrollment and certificate
|
||||
# Create an existing verified enrollment and certificate
|
||||
CourseEnrollmentFactory(
|
||||
user=self.user_2,
|
||||
course_id=self.course.id,
|
||||
@@ -314,15 +314,15 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
|
||||
download_url=download_url
|
||||
)
|
||||
|
||||
self._assert_pdf_cert_generation_dicontinued_logs(download_url)
|
||||
self._assert_pdf_cert_generation_discontinued_logs(download_url)
|
||||
|
||||
def test_add_cert_with_existing_pdf_certificate(self):
|
||||
"""
|
||||
Test that add certifcate for existing PDF certificate log warning
|
||||
message and certificate status remains unchanged.
|
||||
Test that adding a certificate for existing PDF certificates logs a warning
|
||||
message and the certificate status remains unchanged.
|
||||
"""
|
||||
download_url = 'http://www.example.com/certificate.pdf'
|
||||
# Create an existing verifed enrollment and certificate
|
||||
# Create an existing verified enrollment and certificate
|
||||
CourseEnrollmentFactory(
|
||||
user=self.user_2,
|
||||
course_id=self.course.id,
|
||||
@@ -338,9 +338,9 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
|
||||
download_url=download_url
|
||||
)
|
||||
|
||||
self._assert_pdf_cert_generation_dicontinued_logs(download_url, add_cert=True)
|
||||
self._assert_pdf_cert_generation_discontinued_logs(download_url, add_cert=True)
|
||||
|
||||
def _assert_pdf_cert_generation_dicontinued_logs(self, download_url, add_cert=False):
|
||||
def _assert_pdf_cert_generation_discontinued_logs(self, download_url, add_cert=False):
|
||||
"""Assert PDF certificate generation discontinued logs."""
|
||||
with LogCapture(LOGGER.name) as log:
|
||||
if add_cert:
|
||||
|
||||
@@ -288,7 +288,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
def test_regenerate_certificate(self):
|
||||
"""Test web certificate regenration."""
|
||||
"""Test web certificate regeneration."""
|
||||
self.cert.download_url = ''
|
||||
self.cert.save()
|
||||
|
||||
@@ -306,7 +306,7 @@ class CertificateRegenerateTests(CertificateSupportTestCase):
|
||||
|
||||
@patch('lms.djangoapps.certificates.queue.XQueueCertInterface._generate_cert')
|
||||
def test_regenerate_certificate_for_honor_mode(self, mock_generate_cert):
|
||||
"""Test web certificate regenration for the users who have earned the
|
||||
"""Test web certificate regeneration for the users who have earned the
|
||||
certificate in honor mode
|
||||
"""
|
||||
self.cert.mode = 'honor'
|
||||
|
||||
@@ -124,7 +124,7 @@ class UpdateExampleCertificateViewTest(CacheIsolationTestCase):
|
||||
response = self.client.post(self.url, data=payload)
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
def test_update_example_cetificate_non_json_param(self):
|
||||
def test_update_example_certificate_non_json_param(self):
|
||||
payload = {
|
||||
'xqueue_header': '{/invalid',
|
||||
'xqueue_body': '{/invalid'
|
||||
|
||||
@@ -558,7 +558,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase, CacheIsolationTestCase)
|
||||
@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
|
||||
def test_render_certificate_only_for_downloadable_status(self):
|
||||
"""
|
||||
Tests taht Certificate HTML Web View returns Certificate only if certificate status is 'downloadable',
|
||||
Tests that Certificate HTML Web View returns Certificate only if certificate status is 'downloadable',
|
||||
for other statuses it should return "Invalid Certificate".
|
||||
"""
|
||||
self._add_course_certificates(count=1, signatory_count=2)
|
||||
|
||||
@@ -223,7 +223,7 @@ def _update_context_with_basic_info(context, course_id, platform_name, configura
|
||||
|
||||
context['company_contact_urltext'] = _(u"Contact {platform_name}").format(platform_name=platform_name)
|
||||
|
||||
# Translators: This text appears near the top of the certficate and describes the guarantee provided by edX
|
||||
# Translators: This text appears near the top of the certificate and describes the guarantee provided by edX
|
||||
context['document_banner'] = _(u"{platform_name} acknowledges the following student accomplishment").format(
|
||||
platform_name=platform_name
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user