more assertions make the test more readable

This commit is contained in:
Nicolas Delaby 2015-04-29 16:28:48 +02:00
parent d1371cc949
commit 8ad38208a1

View File

@ -49,6 +49,7 @@ class DBTransactionTests(TestCase):
response = self.view(request) response = self.view(request)
self.assertFalse(transaction.get_rollback()) self.assertFalse(transaction.get_rollback())
self.assertEqual(response.status_code, status.HTTP_200_OK) self.assertEqual(response.status_code, status.HTTP_200_OK)
assert BasicModel.objects.count() == 1
@skipUnless(connection.features.uses_savepoints, @skipUnless(connection.features.uses_savepoints,
@ -74,6 +75,7 @@ class DBTransactionErrorTests(TestCase):
with transaction.atomic(): with transaction.atomic():
self.assertRaises(Exception, self.view, request) self.assertRaises(Exception, self.view, request)
self.assertFalse(transaction.get_rollback()) self.assertFalse(transaction.get_rollback())
assert BasicModel.objects.count() == 1
@skipUnless(connection.features.uses_savepoints, @skipUnless(connection.features.uses_savepoints,
@ -103,3 +105,4 @@ class DBTransactionAPIExceptionTests(TestCase):
self.assertTrue(transaction.get_rollback()) self.assertTrue(transaction.get_rollback())
self.assertEqual(response.status_code, self.assertEqual(response.status_code,
status.HTTP_500_INTERNAL_SERVER_ERROR) status.HTTP_500_INTERNAL_SERVER_ERROR)
assert BasicModel.objects.count() == 0