mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
converted asserts of atomic requests test to pytest
This commit is contained in:
parent
e03d88ced7
commit
504f4b44c6
|
@ -67,8 +67,8 @@ class DBTransactionTests(TestCase):
|
|||
|
||||
with self.assertNumQueries(1):
|
||||
response = self.view(request)
|
||||
self.assertFalse(transaction.get_rollback())
|
||||
self.assertEqual(response.status_code, status.HTTP_200_OK)
|
||||
assert not transaction.get_rollback()
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert BasicModel.objects.count() == 1
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ class DBTransactionErrorTests(TestCase):
|
|||
# 3 - release savepoint
|
||||
with transaction.atomic():
|
||||
self.assertRaises(Exception, self.view, request)
|
||||
self.assertFalse(transaction.get_rollback())
|
||||
assert not transaction.get_rollback()
|
||||
assert BasicModel.objects.count() == 1
|
||||
|
||||
|
||||
|
@ -128,9 +128,8 @@ class DBTransactionAPIExceptionTests(TestCase):
|
|||
# 4 - release savepoint (django>=1.8 only)
|
||||
with transaction.atomic():
|
||||
response = self.view(request)
|
||||
self.assertTrue(transaction.get_rollback())
|
||||
self.assertEqual(response.status_code,
|
||||
status.HTTP_500_INTERNAL_SERVER_ERROR)
|
||||
assert transaction.get_rollback()
|
||||
assert response.status_code == status.HTTP_500_INTERNAL_SERVER_ERROR
|
||||
assert BasicModel.objects.count() == 0
|
||||
|
||||
|
||||
|
@ -151,5 +150,4 @@ class NonAtomicDBTransactionAPIExceptionTests(TransactionTestCase):
|
|||
|
||||
# without checking connection.in_atomic_block view raises 500
|
||||
# due attempt to rollback without transaction
|
||||
self.assertEqual(response.status_code,
|
||||
status.HTTP_404_NOT_FOUND)
|
||||
assert response.status_code == status.HTTP_404_NOT_FOUND
|
||||
|
|
Loading…
Reference in New Issue
Block a user