mirror of
https://github.com/pinry/pinry.git
synced 2026-02-24 15:21:02 +01:00
Fix: Fix test failure caused http error code(from 403 to 401)
This commit is contained in:
@@ -32,7 +32,7 @@ class ImageTests(APITestCase):
|
||||
data=data,
|
||||
format='json',
|
||||
)
|
||||
self.assertEqual(response.status_code, 403, response.data)
|
||||
self.assertEqual(response.status_code, 401, response.data)
|
||||
|
||||
|
||||
class BoardPrivacyTests(APITestCase):
|
||||
@@ -220,7 +220,7 @@ class PinTests(APITestCase):
|
||||
self.client.logout()
|
||||
uri = reverse("pin-detail", kwargs={"pk": pin.pk})
|
||||
response = self.client.patch(uri, format='json', data={})
|
||||
self.assertEqual(response.status_code, 403)
|
||||
self.assertEqual(response.status_code, 401, response.data)
|
||||
|
||||
def test_patch_detail(self):
|
||||
image = create_image()
|
||||
@@ -240,7 +240,8 @@ class PinTests(APITestCase):
|
||||
pin = create_pin(self.user, image, [])
|
||||
uri = reverse("pin-detail", kwargs={"pk": pin.pk})
|
||||
self.client.logout()
|
||||
self.assertEqual(self.client.delete(uri).status_code, 403)
|
||||
resp = self.client.delete(uri)
|
||||
self.assertEqual(resp.status_code, 401, resp.data)
|
||||
|
||||
def test_delete_detail(self):
|
||||
image = create_image()
|
||||
|
||||
@@ -165,6 +165,7 @@ REST_FRAMEWORK = {
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
|
||||
'PAGE_SIZE': API_LIMIT_PER_PAGE,
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||
'rest_framework.authentication.BasicAuthentication',
|
||||
'rest_framework.authentication.TokenAuthentication',
|
||||
'rest_framework.authentication.SessionAuthentication',
|
||||
]
|
||||
|
||||
@@ -61,7 +61,7 @@ class CreateUserTest(TestCase):
|
||||
reverse('users:user-list'),
|
||||
data=data,
|
||||
)
|
||||
self.assertEqual(response.status_code, 403)
|
||||
self.assertEqual(response.status_code, 401)
|
||||
|
||||
|
||||
class LogoutViewTest(TestCase):
|
||||
|
||||
Reference in New Issue
Block a user