tests: caor status checks match new model

Issue: #24
This commit is contained in:
Chris Milne 2026-06-12 13:01:04 +01:00
parent fc9d7f8536
commit c0b9763669

View file

@ -92,19 +92,24 @@ async def test_act_on_resource_missing_key(default_client: AsyncClient):
("Test Service", 42, "test_resource", "read", 422), ("Test Service", 42, "test_resource", "read", 422),
("Test Service", "Test Org", None, "read", 422), ("Test Service", "Test Org", None, "read", 422),
("Test Service", "Test Org", 42, "read", 422), ("Test Service", "Test Org", 42, "read", 422),
("Test Service", "Test Org", "test_resource", None, 422),
("Test Service", "Test Org", "test_resource", 42, 422),
], ],
) )
@pytest.mark.anyio @pytest.mark.anyio
async def test_act_on_resource_endpoint_status_checks( async def test_act_on_resource_endpoint_status_checks(
default_client: AsyncClient, service, org, resource, action, expected_status: int default_client: AsyncClient, service, org, resource, action, expected_status: int
): ):
body = {"service": service, "organisation": org, "resource": resource} body = {
"rn": {"service": service, "organisation": org, "resource": resource},
"action": action,
}
headers = { headers = {
"Authorization": "Bearer not_checked_when_auth_is_disabled", "Authorization": "Bearer not_checked_when_auth_is_disabled",
"X-API-Key": "123456789", "X-API-Key": "123456789",
} }
resp = await default_client.post( resp = await default_client.post(
f"/iam/can_act_on_resource?action={action}", json=body, headers=headers "/iam/can_act_on_resource", json=body, headers=headers
) )
assert resp.status_code == expected_status assert resp.status_code == expected_status