@@ -71,8 +71,8 @@ def test_400_parse_error(self):
71
71
expected = {
72
72
'detail' : JSON_ERROR
73
73
}
74
- self . assertEqual ( response .status_code , status .HTTP_400_BAD_REQUEST )
75
- self . assertEqual ( sanitise_json_error (response .data ), expected )
74
+ assert response .status_code == status .HTTP_400_BAD_REQUEST
75
+ assert sanitise_json_error (response .data ) == expected
76
76
77
77
78
78
class FunctionBasedViewIntegrationTests (TestCase ):
@@ -85,8 +85,8 @@ def test_400_parse_error(self):
85
85
expected = {
86
86
'detail' : JSON_ERROR
87
87
}
88
- self . assertEqual ( response .status_code , status .HTTP_400_BAD_REQUEST )
89
- self . assertEqual ( sanitise_json_error (response .data ), expected )
88
+ assert response .status_code == status .HTTP_400_BAD_REQUEST
89
+ assert sanitise_json_error (response .data ) == expected
90
90
91
91
92
92
class TestCustomExceptionHandler (TestCase ):
@@ -107,14 +107,14 @@ def test_class_based_view_exception_handler(self):
107
107
request = factory .get ('/' , content_type = 'application/json' )
108
108
response = view (request )
109
109
expected = 'Error!'
110
- self . assertEqual ( response .status_code , status .HTTP_400_BAD_REQUEST )
111
- self . assertEqual ( response .data , expected )
110
+ assert response .status_code == status .HTTP_400_BAD_REQUEST
111
+ assert response .data == expected
112
112
113
113
def test_function_based_view_exception_handler (self ):
114
114
view = error_view
115
115
116
116
request = factory .get ('/' , content_type = 'application/json' )
117
117
response = view (request )
118
118
expected = 'Error!'
119
- self . assertEqual ( response .status_code , status .HTTP_400_BAD_REQUEST )
120
- self . assertEqual ( response .data , expected )
119
+ assert response .status_code == status .HTTP_400_BAD_REQUEST
120
+ assert response .data == expected
0 commit comments