From 6ce1e6575708d29112f737808d9f3855e59b67f5 Mon Sep 17 00:00:00 2001 From: nathanLYJ Date: Fri, 4 Oct 2024 15:38:08 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20API=20=ED=81=B4=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EC=96=B8=ED=8A=B8=20=EC=83=9D=EC=84=B1=20=EC=8B=9C=20default?= =?UTF-8?q?=5Fformat=EC=9D=84=20"json"=EC=9C=BC=EB=A1=9C=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jwtauth/test/test_authentication.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/jwtauth/test/test_authentication.py b/jwtauth/test/test_authentication.py index d112fca..3898c44 100644 --- a/jwtauth/test/test_authentication.py +++ b/jwtauth/test/test_authentication.py @@ -18,7 +18,9 @@ def api_client(): """ API 클라이언트를 생성하여 반환합니다. """ - return APIClient() + client = APIClient() + client.default_format = "json" + return client @pytest.fixture @@ -140,8 +142,8 @@ def test_JWT_인증_실패_만료된_토큰(api_client, user): url = reverse("refresh") # When: 리프레시 API에 만료된 토큰과 함께 POST 요청을 보냄 response = api_client.post(url) - # Then: 응답 상태 코드가 400 (Bad Request)임 - assert response.status_code == status.HTTP_400_BAD_REQUEST + # Then: 응답 상태 코드가 401 (Unauthorized)임 + assert response.status_code == status.HTTP_401_UNAUTHORIZED @pytest.mark.django_db @@ -152,8 +154,8 @@ def test_JWT_인증_실패_유효하지_않은_토큰(api_client): url = reverse("refresh") # When: 리프레시 API에 유효하지 않은 토큰과 함께 POST 요청을 보냄 response = api_client.post(url) - # Then: 응답 상태 코드가 400 (Bad Request)임 - assert response.status_code == status.HTTP_400_BAD_REQUEST + # Then: 응답 상태 코드가 401 (Unauthorized)임 + assert response.status_code == status.HTTP_401_UNAUTHORIZED @pytest.mark.django_db