From 5515b9dabd8bed41ef95bb52d28bc37ea2c6c068 Mon Sep 17 00:00:00 2001 From: Asif Saifuddin Auvi Date: Wed, 23 Nov 2016 18:33:03 +0600 Subject: [PATCH] converted test_views to pytest style --- tests/test_views.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/test_views.py b/tests/test_views.py index 05c499481..adafa1cd7 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -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