mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 03:23:59 +03:00
more assertions make the test more readable
This commit is contained in:
parent
d1371cc949
commit
8ad38208a1
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user