Commit 588a4e64 by Zia Fazal

generate verify_uuid for web based certificates also

parent 0f94910d
......@@ -4,6 +4,7 @@ import random
import logging
import lxml.html
from lxml.etree import XMLSyntaxError, ParserError # pylint:disable=no-name-in-module
from uuid import uuid4
from django.test.client import RequestFactory
from django.conf import settings
......@@ -336,7 +337,12 @@ class XQueueCertInterface(object):
}
if template_file:
contents['template_pdf'] = template_file
new_status = status.generating if generate_pdf else status.downloadable
if generate_pdf:
new_status = status.generating
else:
new_status = status.downloadable
cert.verify_uuid = uuid4().hex
cert.status = new_status
cert.save()
......
......@@ -22,7 +22,12 @@ from xmodule.modulestore.tests.factories import CourseFactory
from capa.xqueue_interface import XQueueInterface
from certificates.queue import XQueueCertInterface
from certificates.models import ExampleCertificateSet, ExampleCertificate
from certificates.models import (
ExampleCertificateSet,
ExampleCertificate,
GeneratedCertificate,
CertificateStatuses,
)
@attr('shard_1')
......@@ -64,6 +69,9 @@ class XQueueCertInterfaceAddCertificateTest(ModuleStoreTestCase):
# Verify that add_cert method does not add message to queue
self.assertFalse(mock_send.called)
certificate = GeneratedCertificate.objects.get(user=self.user, course_id=self.course.id)
self.assertEqual(certificate.status, CertificateStatuses.downloadable)
self.assertIsNotNone(certificate.verify_uuid)
@attr('shard_1')
......
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