From 147f67b50b10027762188faa91dad11701eb14f6 Mon Sep 17 00:00:00 2001 From: Alexander Saal Date: Wed, 20 May 2026 21:53:03 +0200 Subject: [PATCH] fix(database): align delete fixtures + test to the d0123460 lifecycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The add/get/update fixtures all narrate the lifecycle of a single hypothetical database d0123460 (created by add_database, queried via get_databases with database_login filter, mutated by update_database). The delete fixtures were the lone outlier — request + response echo both showed d0123456 — and the matching TestClientDelete called Delete(..., "d0123456") to track them. The mismatch was harmless at runtime (the FakeCaller stubs the call before any fixture lookup) but broke the slice-wide narrative: a reader skimming testdata/database/ saw d0123460 in five files and d0123456 in two without an obvious why. The delete request + response are now aligned to d0123460, and TestClientDelete tracks them — the whole testdata/database/ set now tells one continuous add → get → update → delete story for a single database. The list fixture (get_databases_response_success.xml) is intentionally unchanged: it covers five entries d0123456..d0123460, and the read tests assert against the first one (d0123456) by index, which remains correct. Also normalises the request envelope's auth placeholders ({{kas_auth_data_session}}/…/{{kas_login}}) to the same redacted form the other database request fixtures use, so the captured request shape is consistent across the slice. --- internal/database/write_test.go | 4 ++-- testdata/database/delete_database_request.xml | 8 ++++---- testdata/database/delete_database_response_success.xml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/database/write_test.go b/internal/database/write_test.go index 0824c30..88e194a 100644 --- a/internal/database/write_test.go +++ b/internal/database/write_test.go @@ -89,13 +89,13 @@ func TestClientDelete(t *testing.T) { t.Parallel() resp := testutil.DecodeFixture(t, "database/delete_database_response_success.xml") fc := &testutil.FakeCaller{Resp: resp} - if err := database.NewClient(fc).Delete(context.Background(), "d0123456"); err != nil { + if err := database.NewClient(fc).Delete(context.Background(), "d0123460"); err != nil { t.Fatalf("Delete: %v", err) } if fc.GotAction != "delete_database" { t.Errorf("action = %q, want delete_database", fc.GotAction) } - if fc.GotParams["database_login"] != "d0123456" { + if fc.GotParams["database_login"] != "d0123460" { t.Errorf("params = %v", fc.GotParams) } } diff --git a/testdata/database/delete_database_request.xml b/testdata/database/delete_database_request.xml index 38010d2..3760e0c 100644 --- a/testdata/database/delete_database_request.xml +++ b/testdata/database/delete_database_request.xml @@ -5,12 +5,12 @@ { "KasRequestParams": { - "database_login": "d0123456" + "database_login": "d0123460" }, "kas_action": "delete_database", - "kas_auth_data": "{{kas_auth_data_session}}", - "kas_auth_type": "{{kas_auth_type_session}}", - "kas_login": "{{kas_login}}" + "kas_auth_data": "REDACTED", + "kas_auth_type": "session", + "kas_login": "w0000000" } diff --git a/testdata/database/delete_database_response_success.xml b/testdata/database/delete_database_response_success.xml index e1e452c..e0d6b3e 100644 --- a/testdata/database/delete_database_response_success.xml +++ b/testdata/database/delete_database_response_success.xml @@ -19,7 +19,7 @@ database_login - d0123456 + d0123460 @@ -50,7 +50,7 @@ text - The database d0123456 has been deleted. + The database d0123460 has been deleted.