mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
cbeb5157d6
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
38 lines
686 B
Go
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)
|
|
}
|
|
})
|
|
}
|
|
}
|