From 836f891f64f8364d1e6f6bbf070e5f63389897c7 Mon Sep 17 00:00:00 2001 From: Charles Connell Date: Tue, 14 Jan 2014 19:07:38 -0500 Subject: [PATCH] Fix failing test --- karmaworld/apps/courses/test/test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/karmaworld/apps/courses/test/test.py b/karmaworld/apps/courses/test/test.py index 6a424e2..30a4146 100644 --- a/karmaworld/apps/courses/test/test.py +++ b/karmaworld/apps/courses/test/test.py @@ -18,12 +18,15 @@ class CoursesTests(TestCase): self.client = Client() def testCourseUniqueness(self): - """Make sure we can't create multiple courses with the same - name + department name combination.""" + """Make sure we can't create multiple courses with the same unique constraint.""" with self.assertRaises(IntegrityError): Course.objects.create(name=self.course1.name, instructor_name=self.course1.instructor_name, school=self.course1.school, department=self.department) - self.assertEqual(Course.objects.count(), 1) + # We can't actually do anything with Course.objects now, + # because every database hit in a single test is wrapped in one + # transaction, and now that we have an integrity error, + # the transaction is borked. Look into TransactionTestCase. + #self.assertEqual(Course.objects.count(), 1) def testSchoolSlug(self): self.assertEqual(self.harvard.slug, slugify(unicode(self.harvard.name))) -- 2.25.1