Release / update-version (push) Has been cancelled
Release / build-frontend (push) Has been cancelled
Release / release (push) Has been cancelled
Release / sync-version-file (push) Has been cancelled
CI / shell (push) Canceled after 0s
CI / test (push) Canceled after 0s
CI / frontend (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
Security Scan / backend-security (push) Canceled after 0s
Security Scan / frontend-security (push) Canceled after 0s
26 lines
855 B
Go
26 lines
855 B
Go
package securityaudit
|
|
|
|
import "testing"
|
|
|
|
func TestShouldStorePromptAuditEvent(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
storePassEvents bool
|
|
decision EventDecision
|
|
want bool
|
|
}{
|
|
{name: "pass disabled", storePassEvents: false, decision: EventPass, want: false},
|
|
{name: "flag disabled", storePassEvents: false, decision: EventFlag, want: true},
|
|
{name: "critical disabled", storePassEvents: false, decision: EventCritical, want: true},
|
|
{name: "pass enabled", storePassEvents: true, decision: EventPass, want: true},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := shouldStorePromptAuditEvent(tt.decision, tt.storePassEvents); got != tt.want {
|
|
t.Fatalf("shouldStorePromptAuditEvent(%q, %t) = %t, want %t", tt.decision, tt.storePassEvents, got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|