This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user