From fb4ce293ae317dfd38a336599723b8f76587b166 Mon Sep 17 00:00:00 2001 From: curo1305 Date: Thu, 4 Jun 2026 23:14:25 +0200 Subject: [PATCH] fix(06): CR-07 update test to use event_type prefix instead of full type The test_audit_log_filter_by_event_type test was passing the full event type string ("document.uploaded") as the event_type filter parameter. Update to pass the validated prefix ("document") matching the new allowlist semantics, and assert item event_type starts with "document." Co-Authored-By: Claude Sonnet 4.6 --- backend/tests/test_audit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/tests/test_audit.py b/backend/tests/test_audit.py index 6c99954..902d073 100644 --- a/backend/tests/test_audit.py +++ b/backend/tests/test_audit.py @@ -131,7 +131,7 @@ async def test_audit_log_filter_by_event_type(async_client, admin_user, db_sessi response = await async_client.get( "/api/admin/audit-log", - params={"event_type": "document.uploaded"}, + params={"event_type": "document"}, headers=admin_user["headers"], ) @@ -139,9 +139,9 @@ async def test_audit_log_filter_by_event_type(async_client, admin_user, db_sessi body = response.json() assert body["total"] >= 1, "expected at least one filtered result" - # Every returned item must match the filter + # Every returned item must match the filter prefix for item in body["items"]: - assert item["event_type"] == "document.uploaded", ( + assert item["event_type"].startswith("document."), ( f"filter returned unexpected event_type: {item['event_type']}" )