From a2380028f042b11ce314fa2b1064051cd703fd7b Mon Sep 17 00:00:00 2001 From: Cristian Magherusan-Stanciu Date: Mon, 28 Sep 2026 22:03:33 +0200 Subject: [PATCH] test(api): align scope matrix fixtures with the #416 approve API #381 and #416 merged back to back and were each green alone. #416 made ApproveAndExecute and RunPlannedPurchaseNow return (string, error) and stores approval tokens hashed, so the #381 matrix test panicked on its single-value mock returns and its revoke fixture stored a raw token. Closes #439 --- internal/api/execution_scope_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/api/execution_scope_test.go b/internal/api/execution_scope_test.go index 4e32047e2..2944998a4 100644 --- a/internal/api/execution_scope_test.go +++ b/internal/api/execution_scope_test.go @@ -211,8 +211,8 @@ func newScopeTestHandler(t *testing.T, exec *config.PurchaseExecution, scope []s store.On("TransitionExecutionStatus", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil, errScopeTestReached).Maybe() store.On("CancelExecutionAtomic", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(false, "", errScopeTestReached).Maybe() store.On("CancelScheduledExecutionAtomic", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(false, "", errScopeTestReached).Maybe() - mockPurchase.On("ApproveAndExecute", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(errScopeTestReached).Maybe() - mockPurchase.On("RunPlannedPurchaseNow", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(errScopeTestReached).Maybe() + mockPurchase.On("ApproveAndExecute", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return("", errScopeTestReached).Maybe() + mockPurchase.On("RunPlannedPurchaseNow", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return("", errScopeTestReached).Maybe() mockPurchase.On("CancelExecution", mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(nil).Maybe() return &Handler{auth: mockAuth, config: store, purchase: mockPurchase} @@ -321,7 +321,7 @@ func TestRevoke_AuthorizedNonRevocableStatusIs409(t *testing.T) { for _, status := range []string{"pending", "notified", "failed"} { t.Run(tc.name+"/"+status, func(t *testing.T) { exec := scopeTestExecution(stageOnly, status) - exec.ApprovalToken = "email-token" + exec.ApprovalToken = config.HashApprovalToken("email-token") store := new(MockConfigStore) h := newScopeTestHandler(t, exec, tc.scope, store, new(MockPurchaseManager))