Files
urutau/internal/store/events_test.go
T

20 lines
607 B
Go

package store
import "testing"
func TestCatSet(t *testing.T) {
if catSet("") != nil {
t.Fatal("empty list must mean no filter")
}
if m := catSet("exploit,ban"); len(m) != 2 || !m["exploit"] || !m["ban"] {
t.Fatalf("plain list: %v", m)
}
m := catSet("!ok")
if m["ok"] || len(m) != 8 || !m["notfound"] || !m["scanner"] || !m["exploit"] || !m["bruteforce"] || !m["ssh-fail"] || !m["ssh-probe"] || !m["ssh-ok"] || !m["ban"] {
t.Fatalf("!ok must keep every other category: %v", m)
}
if m := catSet("!ok,notfound"); m["ok"] || m["notfound"] || len(m) != 7 {
t.Fatalf("!ok,notfound: %v", m)
}
}