Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions internal/api/coverage_extras_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ func TestHandler_approvePurchase_PurchaseError(t *testing.T) {
mockConfig.On("GetGlobalConfig", ctx).Return(&config.GlobalConfig{}, nil)

mockAuth := new(MockAuthService)

mockAuth.On("GetAllowedAccountsAPI", mock.Anything, mock.Anything).Return(nil, nil).Maybe()
mockAuth.On("ValidateSession", ctx, "sess-tok").Return(&Session{Email: approver}, nil)
// After issue #286, approvePurchase is session-first: with a Bearer
// header present the dispatch consults the approve-{any,own} RBAC
Expand Down Expand Up @@ -155,6 +157,8 @@ func TestHandler_cancelPurchase_PurchaseError(t *testing.T) {
mockConfig.On("GetGlobalConfig", ctx).Return(&config.GlobalConfig{}, nil)

mockAuth := new(MockAuthService)

mockAuth.On("GetAllowedAccountsAPI", mock.Anything, mock.Anything).Return(nil, nil).Maybe()
mockAuth.On("ValidateSession", ctx, "sess-tok").Return(&Session{Email: approver}, nil)
// Session has no admin role / cancel permissions → cancelPurchase's
// session-authed pre-check falls through to authorizeApprovalAction →
Expand Down
4 changes: 4 additions & 0 deletions internal/api/executed_notification_flow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func TestExecutedNotification_TokenApprovePath(t *testing.T) {
}, nil)

mockAuth := new(MockAuthService)

mockAuth.On("GetAllowedAccountsAPI", mock.Anything, mock.Anything).Return(nil, nil).Maybe()
mockAuth.On("ValidateSession", ctx, "sess-tok").Return(&Session{Email: contact}, nil)
mockAuth.On("HasPermissionAPI", ctx, "", "approve-any", "purchases").Return(false, nil).Maybe()
mockAuth.On("HasPermissionAPI", ctx, "", "approve-own", "purchases").Return(false, nil).Maybe()
Expand Down Expand Up @@ -166,6 +168,8 @@ func TestExecutedNotification_TokenApprovePath_RefetchFailureSuppressesPanel(t *
}, nil)

mockAuth := new(MockAuthService)

mockAuth.On("GetAllowedAccountsAPI", mock.Anything, mock.Anything).Return(nil, nil).Maybe()
mockAuth.On("ValidateSession", ctx, "sess-tok").Return(&Session{Email: contact}, nil)
mockAuth.On("HasPermissionAPI", ctx, "", "approve-any", "purchases").Return(false, nil).Maybe()
mockAuth.On("HasPermissionAPI", ctx, "", "approve-own", "purchases").Return(false, nil).Maybe()
Expand Down
Loading
Loading