test(ha): Token deaktivierter Firma liefert 404
Security Audit / Python Dependency Audit (push) Canceled after 0s
Security Audit / Node.js Dependency Audit (push) Canceled after 0s
Security Audit / Frontend Build (tsc + vite) (push) Canceled after 0s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Sonnet 5.5 committed 2026-11-05 00:17:59 +01:00
1 parent b6eda4e2d5
commit 8a55e183fd
1 file changed
+13
+13
View File
@@ -59,3 +59,16 @@ async def test_ha_status_lifecycle(client: AsyncClient, ha_headers):
d = await client.delete("/api/v1/users/me/ha-token", headers=ha_headers)
assert d.status_code == 204
assert (await client.get("/api/v1" + new_path)).status_code == 404
@pytest.mark.asyncio(loop_scope="session")
async def test_ha_token_rejected_for_inactive_company(client: AsyncClient, ha_headers, db_session):
from sqlalchemy import text
r = await client.post("/api/v1/users/me/ha-token", json={}, headers=ha_headers)
path = r.json()["url"].split("/api/v1", 1)[1]
assert (await client.get("/api/v1" + path)).status_code == 200
await db_session.execute(text("SET LOCAL app.bypass_rls = 'on'"))
await db_session.execute(text("UPDATE companies SET is_active = false WHERE name = 'HA GmbH'"))
await db_session.commit()
assert (await client.get("/api/v1" + path)).status_code == 404