http_test.go (352B)
1 package icinga 2 3 import "testing" 4 5 func TestFilterEncode(t *testing.T) { 6 expr := `match("*.example.com"), host.name) && "test" in host.groups` 7 want := "filter=match%28%22%2A.example.com%22%29%2C%20host.name%29%20%26%26%20%22test%22%20in%20host.groups" 8 got := filterEncode(expr) 9 if want != got { 10 t.Fail() 11 } 12 t.Logf("want %s, got %s", want, got) 13 }