Commit 480cf570 by Andy Armstrong

Improve test failure message

parent 37eba6ac
......@@ -302,6 +302,12 @@ class GeneratedCertificate(models.Model):
else:
return query.values('status').annotate(count=Count('status'))
def __repr__(self):
return "<GeneratedCertificate: {course_id}, user={user}>".format(
course_id=self.course_id,
user=self.user
)
def invalidate(self):
"""
Invalidate Generated Certificate by marking it 'unavailable'.
......
......@@ -369,6 +369,7 @@ class CertificateGetTests(SharedModuleStoreTestCase):
@classmethod
def tearDownClass(cls):
super(CertificateGetTests, cls).tearDownClass()
cls.freezer.stop()
def test_get_certificate_for_user(self):
......
......@@ -721,7 +721,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
course_id=unicode(self.course.id)
)
self.cert.delete()
self.assertEqual(len(GeneratedCertificate.eligible_certificates.all()), 0)
self.assertListEqual(list(GeneratedCertificate.eligible_certificates.all()), [])
response = self.client.get(test_url)
self.assertIn('invalid', response.content)
......@@ -744,7 +744,7 @@ class CertificatesViewsTests(CommonCertificatesTestCase):
preview mode. Either the certificate is marked active or not.
"""
self.cert.delete()
self.assertEqual(len(GeneratedCertificate.eligible_certificates.all()), 0)
self.assertListEqual(list(GeneratedCertificate.eligible_certificates.all()), [])
self._add_course_certificates(count=1, signatory_count=2)
test_url = get_certificate_url(
user_id=self.user.id,
......
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