Skip to content

Commit

Permalink
refactor: API 클라이언트 생성 시 default_format을 "json"으로 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanLYJ committed Oct 4, 2024
1 parent b169c82 commit 6ce1e65
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions jwtauth/test/test_authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ def api_client():
"""
API 클라이언트를 생성하여 반환합니다.
"""
return APIClient()
client = APIClient()
client.default_format = "json"
return client


@pytest.fixture
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 6ce1e65

Please sign in to comment.