Public source validation / validate (push) Failing after 3m8s
20 lines
592 B
Go
20 lines
592 B
Go
package audit
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestSecurityActionsAreStoredWithCorrelation(t *testing.T) {
|
|
store := &MemoryStore{}
|
|
if err := RecordSecurityAction(context.Background(), store, "user-1", "config.update", "success", "corr-1234"); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if len(store.Events) != 1 || store.Events[0].CorrelationID != "corr-1234" || store.Events[0].Action != "config.update" {
|
|
t.Fatalf("unexpected audit event: %#v", store.Events)
|
|
}
|
|
if store.Events[0].ID == "" || store.Events[0].OccurredAt.IsZero() {
|
|
t.Fatal("audit event lacks identity or timestamp")
|
|
}
|
|
}
|