feat: 로그아웃하면 서버에서도 그 계정의 토큰을 모두 무효로

This commit is contained in:
minaChoi committed 2026-10-06 10:49:39 +09:00
1 parent be8f827556
commit 296a09d6db
11 files changed
+108 -10

No files matched your search

+12
View File
@@ -109,3 +109,15 @@ async def test_update_me_changes_character_and_nickname_and_shows_on_comments(of
assert (comments[0]["character"], comments[0]["color"], comments[0]["nickname"]) == ("bear", "blue", "곰돌이")
assert comments[0]["mood"] == "thunder"
assert "mood" not in (await c.patch("/v1/auth/me", headers=h, json={"mood": ""})).json()["me"]
@pytest.mark.anyio
async def test_logout_invalidates_access_and_refresh_tokens():
async with client() as c:
body = await _signup(c, login_id="mina_out")
h = {"Authorization": f"Bearer {body['access_token']}"}
assert (await c.post("/v1/auth/logout", headers=h)).json()["result"]["success"] is True
assert (await c.get("/v1/auth/me", headers=h)).status_code == 401
assert (await c.post("/v1/auth/refresh", json={"refresh_token": body["refresh_token"]})).json()["result"]["desc"] == "AUTH_TOKEN_INVALID"
again = (await c.post("/v1/auth/login", json={"login_id": "mina_out", "password": "password1"})).json()
assert (await c.get("/v1/auth/me", headers={"Authorization": f"Bearer {again['access_token']}"})).status_code == 200