mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 21:10:13 +03:00
converted test_views to pytest style
This commit is contained in:
parent
4ec8bc5de0
commit
5515b9dabd
|
@ -71,8 +71,8 @@ class ClassBasedViewIntegrationTests(TestCase):
|
|||
expected = {
|
||||
'detail': JSON_ERROR
|
||||
}
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
self.assertEqual(sanitise_json_error(response.data), expected)
|
||||
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||
assert sanitise_json_error(response.data) == expected
|
||||
|
||||
|
||||
class FunctionBasedViewIntegrationTests(TestCase):
|
||||
|
@ -85,8 +85,8 @@ class FunctionBasedViewIntegrationTests(TestCase):
|
|||
expected = {
|
||||
'detail': JSON_ERROR
|
||||
}
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
self.assertEqual(sanitise_json_error(response.data), expected)
|
||||
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||
assert sanitise_json_error(response.data) == expected
|
||||
|
||||
|
||||
class TestCustomExceptionHandler(TestCase):
|
||||
|
@ -107,8 +107,8 @@ class TestCustomExceptionHandler(TestCase):
|
|||
request = factory.get('/', content_type='application/json')
|
||||
response = view(request)
|
||||
expected = 'Error!'
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
self.assertEqual(response.data, expected)
|
||||
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||
assert response.data == expected
|
||||
|
||||
def test_function_based_view_exception_handler(self):
|
||||
view = error_view
|
||||
|
@ -116,5 +116,5 @@ class TestCustomExceptionHandler(TestCase):
|
|||
request = factory.get('/', content_type='application/json')
|
||||
response = view(request)
|
||||
expected = 'Error!'
|
||||
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
|
||||
self.assertEqual(response.data, expected)
|
||||
assert response.status_code == status.HTTP_400_BAD_REQUEST
|
||||
assert response.data == expected
|
||||
|
|
Loading…
Reference in New Issue
Block a user