mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 07:57:07 +00:00
25 lines
659 B
Go
25 lines
659 B
Go
|
package engine
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func Test_Paths(t *testing.T) {
|
||
|
f := func(path, expected string) {
|
||
|
p, err := NewAPIPath(path)
|
||
|
if err != nil {
|
||
|
t.Error(err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
if p.String() != expected {
|
||
|
t.Errorf("expected %s got %s", expected, p.String())
|
||
|
}
|
||
|
}
|
||
|
|
||
|
f("/api/v1/namespace/{{ request.namespace }}", "/api/v1/namespace/{{ request.namespace }}")
|
||
|
f("/api/v1/namespace/{{ request.namespace }}/", "/api/v1/namespace/{{ request.namespace }}")
|
||
|
f("/api/v1/namespace/{{ request.namespace }}/ ", "/api/v1/namespace/{{ request.namespace }}")
|
||
|
f(" /api/v1/namespace/{{ request.namespace }}", "/api/v1/namespace/{{ request.namespace }}")
|
||
|
}
|