Use shared SESSION_COOKIE_NAME in auth router tests
This commit is contained in:
@@ -8,6 +8,8 @@ from unittest.mock import patch
|
||||
import pytest
|
||||
from httpx import AsyncClient
|
||||
|
||||
from app.utils.constants import SESSION_COOKIE_NAME
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -64,8 +66,8 @@ class TestLogin:
|
||||
"/api/auth/login", json={"password": "mysecretpass1"}
|
||||
)
|
||||
assert response.status_code == 200
|
||||
assert "bangui_session" in response.cookies
|
||||
assert "." in response.cookies["bangui_session"]
|
||||
assert SESSION_COOKIE_NAME in response.cookies
|
||||
assert "." in response.cookies[SESSION_COOKIE_NAME]
|
||||
set_cookie = response.headers.get("set-cookie", "")
|
||||
assert "HttpOnly" in set_cookie
|
||||
assert "SameSite=lax" in set_cookie
|
||||
@@ -124,7 +126,7 @@ class TestLogout:
|
||||
assert response.status_code == 200
|
||||
# Cookie should be set to empty / deleted in the Set-Cookie header.
|
||||
set_cookie = response.headers.get("set-cookie", "")
|
||||
assert "bangui_session" in set_cookie
|
||||
assert SESSION_COOKIE_NAME in set_cookie
|
||||
|
||||
async def test_logout_is_idempotent(self, client: AsyncClient) -> None:
|
||||
"""Logout succeeds even when called without a session token."""
|
||||
|
||||
Reference in New Issue
Block a user