fix(tests): test_historie_standort_eingeschraenkt falsche Rolle
CI / backend-tests (push) Successful in 3m40s
CI / frontend-build (push) Successful in 22s

CI-Fund: Test nutzte mitarbeiter_user, aber /historie war schon vor
ZUST-004 auf _verantwortliche (Administration/Materialverantwortliche/
Leitung) beschränkt - reiner Mitarbeiter bekam korrekt 403, unabhängig von
der neuen Standort-Prüfung. Kein Code-Bug, nur falsche Testannahme.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VDMvneg6wKfXdXvTYNd3dN
This commit is contained in:
patrickandClaude Sonnet 5 committed 2026-09-14 23:15:48 +02:00
1 parent 6c05d4514d
commit 6f116edd51
1 file changed
+8 -3
@@ -292,7 +292,12 @@ async def test_objekt_zaehlerstand_und_aussonderung_uebergabeliste_standort_eing
@pytest.mark.asyncio
async def test_historie_standort_eingeschraenkt(client, admin_user, mitarbeiter_user, standort_factory, objekt_factory):
async def test_historie_standort_eingeschraenkt(
client, admin_user, materialverantwortlicher_user, standort_factory, objekt_factory
):
"""/historie ist bereits vor ZUST-004 auf _verantwortliche (Administration/
Materialverantwortliche/Leitung) beschränkt - reiner Mitarbeiter kommt
gar nicht erst rein, unabhängig von Standort-Sichtbarkeit."""
standort_a = await standort_factory("Standort A10")
standort_b = await standort_factory("Standort B10")
objekt_b = await objekt_factory(name="Objekt B10", code="ZUST4-B10", standort=standort_b)
@@ -302,12 +307,12 @@ async def test_historie_standort_eingeschraenkt(client, admin_user, mitarbeiter_
f"/api/v1/objekte/{objekt_b.id}", json={"status": "in_wartung"}, headers=auth_header(admin_token)
)
await client.put(
f"/api/v1/benutzer/{mitarbeiter_user.id}/standorte",
f"/api/v1/benutzer/{materialverantwortlicher_user.id}/standorte",
json={"standort_ids": [standort_a.id]},
headers=auth_header(admin_token),
)
token = await login(client, "mitarbeiter1")
token = await login(client, "materialverantwortlicher1")
ok = await client.get("/api/v1/historie", headers=auth_header(token))
assert ok.status_code == 200 # ohne entitaet-Filter unverändert erreichbar