fix(orgtoken): sync test mocks with actual query column count

Real Validate() query: SELECT id, prefix, org_id FROM org_api_tokens
Real List() query: SELECT id, prefix, name, org_id, created_by, created_at, last_used_at FROM org_api_tokens

Fixes:
- TestValidate_HappyPath: add org_id to mock row (was 2 cols, query returns 3)
- TestList_NewestFirst: fix column list AND AddRow calls to match List() query
  (7 columns: id, prefix, name, org_id, created_by, created_at, last_used_at)

This resolves the Platform (Go) CI failure blocking all molecule-core PRs.

Ref: pre-existing failure, unrelated to F1085 security fix.
This commit is contained in:
Molecule AI · infra-lead 2026-04-22 23:08:24 +00:00 committed by Molecule AI Infra-SRE
parent b4cd78729d
commit c2dd4db36d

View File

@ -145,7 +145,7 @@ func TestList_NewestFirst(t *testing.T) {
now := time.Now()
earlier := now.Add(-1 * time.Hour)
mock.ExpectQuery(`SELECT id, prefix.*FROM org_api_tokens.*ORDER BY created_at DESC`).
mock.ExpectQuery(`SELECT id, prefix, name, org_id, created_by, created_at, last_used_at FROM org_api_tokens ORDER BY created_at DESC`).
WithArgs(listMax).
WillReturnRows(sqlmock.NewRows([]string{"id", "prefix", "name", "org_id", "created_by", "created_at", "last_used_at"}).
AddRow("t2", "abcd1234", "zapier", "org-1", "user_01", now, now).