Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
504f4b44
Commit
504f4b44
authored
Nov 30, 2016
by
Asif Saifuddin Auvi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
converted asserts of atomic requests test to pytest
parent
e03d88ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
8 deletions
+6
-8
tests/test_atomic_requests.py
+6
-8
No files found.
tests/test_atomic_requests.py
View file @
504f4b44
...
@@ -67,8 +67,8 @@ class DBTransactionTests(TestCase):
...
@@ -67,8 +67,8 @@ class DBTransactionTests(TestCase):
with
self
.
assertNumQueries
(
1
):
with
self
.
assertNumQueries
(
1
):
response
=
self
.
view
(
request
)
response
=
self
.
view
(
request
)
self
.
assertFalse
(
transaction
.
get_rollback
()
)
assert
not
transaction
.
get_rollback
(
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_200_OK
)
assert
response
.
status_code
==
status
.
HTTP_200_OK
assert
BasicModel
.
objects
.
count
()
==
1
assert
BasicModel
.
objects
.
count
()
==
1
...
@@ -98,7 +98,7 @@ class DBTransactionErrorTests(TestCase):
...
@@ -98,7 +98,7 @@ class DBTransactionErrorTests(TestCase):
# 3 - release savepoint
# 3 - release savepoint
with
transaction
.
atomic
():
with
transaction
.
atomic
():
self
.
assertRaises
(
Exception
,
self
.
view
,
request
)
self
.
assertRaises
(
Exception
,
self
.
view
,
request
)
self
.
assertFalse
(
transaction
.
get_rollback
()
)
assert
not
transaction
.
get_rollback
(
)
assert
BasicModel
.
objects
.
count
()
==
1
assert
BasicModel
.
objects
.
count
()
==
1
...
@@ -128,9 +128,8 @@ class DBTransactionAPIExceptionTests(TestCase):
...
@@ -128,9 +128,8 @@ class DBTransactionAPIExceptionTests(TestCase):
# 4 - release savepoint (django>=1.8 only)
# 4 - release savepoint (django>=1.8 only)
with
transaction
.
atomic
():
with
transaction
.
atomic
():
response
=
self
.
view
(
request
)
response
=
self
.
view
(
request
)
self
.
assertTrue
(
transaction
.
get_rollback
())
assert
transaction
.
get_rollback
()
self
.
assertEqual
(
response
.
status_code
,
assert
response
.
status_code
==
status
.
HTTP_500_INTERNAL_SERVER_ERROR
status
.
HTTP_500_INTERNAL_SERVER_ERROR
)
assert
BasicModel
.
objects
.
count
()
==
0
assert
BasicModel
.
objects
.
count
()
==
0
...
@@ -151,5 +150,4 @@ class NonAtomicDBTransactionAPIExceptionTests(TransactionTestCase):
...
@@ -151,5 +150,4 @@ class NonAtomicDBTransactionAPIExceptionTests(TransactionTestCase):
# without checking connection.in_atomic_block view raises 500
# without checking connection.in_atomic_block view raises 500
# due attempt to rollback without transaction
# due attempt to rollback without transaction
self
.
assertEqual
(
response
.
status_code
,
assert
response
.
status_code
==
status
.
HTTP_404_NOT_FOUND
status
.
HTTP_404_NOT_FOUND
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment