test(ha): Token deaktivierter Firma liefert 404
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b6eda4e2d5
commit
8a55e183fd
1 file changed
+13
@@ -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)
|
d = await client.delete("/api/v1/users/me/ha-token", headers=ha_headers)
|
||||||
assert d.status_code == 204
|
assert d.status_code == 204
|
||||||
assert (await client.get("/api/v1" + new_path)).status_code == 404
|
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
|
||||||
Reference in new issue
Block a user