Use shared SESSION_COOKIE_NAME in auth router tests

This commit is contained in:
2026-04-14 10:33:32 +02:00
parent 5e4d3fcf12
commit 0e5e08374f
2 changed files with 8 additions and 5 deletions

View File

@@ -18,6 +18,7 @@ from app.dependencies import get_auth_service, get_jail_service
from app.main import create_app
from app.models.auth import Session
from app.models.jail import JailListResponse
from app.utils.constants import SESSION_COOKIE_NAME
from app.utils.setup_state import set_setup_complete_cache
@@ -149,7 +150,7 @@ async def test_auth_login_uses_injected_auth_service(tmp_path: Path) -> None:
assert response.status_code == 200
assert response.json()["token"].startswith("fake-token")
assert response.cookies.get("bangui_session") is not None
assert response.cookies.get(SESSION_COOKIE_NAME) is not None
async def test_jail_list_uses_injected_jail_service_and_auth(tmp_path: Path) -> None:
@@ -180,7 +181,7 @@ async def test_jail_list_uses_injected_jail_service_and_auth(tmp_path: Path) ->
) as client:
response = await client.get(
"/api/jails",
headers={"Cookie": "bangui_session=fake-token"},
headers={"Cookie": f"{SESSION_COOKIE_NAME}=fake-token"},
)
await db.close()