1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/cmd/cli/kubectl-kyverno/source/http_test.go
Charles-Edouard Brétéché cbeb5157d6
refactor: cli policy package (#8279)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 23:01:31 +00:00

38 lines
686 B
Go

package source
import "testing"
func TestIsHttp(t *testing.T) {
tests := []struct {
name string
in string
want bool
}{{
name: "empty",
in: "",
want: false,
}, {
name: "http",
in: "http://github.com/kyverno/policies",
want: true,
}, {
name: "https",
in: "https://github.com/kyverno/policies",
want: true,
}, {
name: "local path",
in: "/github.com/kyverno/policies",
want: false,
}, {
name: "local path",
in: "/https/kyverno/policies",
want: false,
}}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := IsHttp(tt.in); got != tt.want {
t.Errorf("IsHttp() = %v, want %v", got, tt.want)
}
})
}
}