From fece81865c8eec3218629f023b3488dff25c5868 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Sat, 8 May 2021 10:46:41 +0900 Subject: [PATCH] Update test cases to add format=json --- backend/api/tests/api/test_label.py | 4 ++-- backend/api/tests/api/test_project.py | 6 +++--- backend/api/tests/api/test_tag.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/api/tests/api/test_label.py b/backend/api/tests/api/test_label.py index 9037dd16..ada14cb0 100644 --- a/backend/api/tests/api/test_label.py +++ b/backend/api/tests/api/test_label.py @@ -56,7 +56,7 @@ class TestLabelCreate(APITestCase): def assert_create_label(self, user=None, expected_status=status.HTTP_403_FORBIDDEN): if user: self.client.force_login(user) - response = self.client.post(self.url, data=self.data) + response = self.client.post(self.url, data=self.data, format='json') self.assertEqual(response.status_code, expected_status) def test_allows_admin_to_create_label(self): @@ -101,7 +101,7 @@ class TestLabelDetailAPI(APITestCase): def assert_update_label(self, user=None, expected_status=status.HTTP_403_FORBIDDEN): if user: self.client.force_login(user) - response = self.client.patch(self.url, data=self.data) + response = self.client.patch(self.url, data=self.data, format='json') self.assertEqual(response.status_code, expected_status) return response diff --git a/backend/api/tests/api/test_project.py b/backend/api/tests/api/test_project.py index 8650e458..17d9c4e4 100644 --- a/backend/api/tests/api/test_project.py +++ b/backend/api/tests/api/test_project.py @@ -45,12 +45,12 @@ class TestProjectCreate(APITestCase): def test_allow_authenticated_user_to_create_project(self): self.client.force_login(self.user) - response = self.client.post(self.url, data=self.data) + response = self.client.post(self.url, data=self.data, format='json') self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.data['name'], self.data['name']) def test_disallow_unauthenticated_user_to_create_project(self): - response = self.client.post(self.url, self.data) + response = self.client.post(self.url, self.data, format='json') self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN) @@ -76,7 +76,7 @@ class TestProjectDetailAPI(APITestCase): def assert_update_project(self, user, expected): self.client.force_login(user) - response = self.client.patch(self.url, data=self.data) + response = self.client.patch(self.url, data=self.data, format='json') self.assertEqual(response.status_code, expected) return response diff --git a/backend/api/tests/api/test_tag.py b/backend/api/tests/api/test_tag.py index e3c1f8d6..ca029b4d 100644 --- a/backend/api/tests/api/test_tag.py +++ b/backend/api/tests/api/test_tag.py @@ -43,7 +43,7 @@ class TestTagCreate(APITestCase): def assert_create_tag(self, user=None, expected=status.HTTP_403_FORBIDDEN): if user: self.client.force_login(user) - response = self.client.post(self.url, data=self.data) + response = self.client.post(self.url, data=self.data, format='json') self.assertEqual(response.status_code, expected) return response