2014-10-03 19:46:42 +00:00
|
|
|
package registry
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestEndpointParse(t *testing.T) {
|
|
|
|
testData := []struct {
|
|
|
|
str string
|
|
|
|
expected string
|
|
|
|
}{
|
|
|
|
{IndexServerAddress(), IndexServerAddress()},
|
|
|
|
{"http://0.0.0.0:5000", "http://0.0.0.0:5000/v1/"},
|
|
|
|
{"0.0.0.0:5000", "https://0.0.0.0:5000/v1/"},
|
|
|
|
}
|
|
|
|
for _, td := range testData {
|
2014-10-07 01:54:52 +00:00
|
|
|
e, err := newEndpoint(td.str, false)
|
2014-10-03 19:46:42 +00:00
|
|
|
if err != nil {
|
|
|
|
t.Errorf("%q: %s", td.str, err)
|
|
|
|
}
|
|
|
|
if e == nil {
|
|
|
|
t.Logf("something's fishy, endpoint for %q is nil", td.str)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if e.String() != td.expected {
|
|
|
|
t.Errorf("expected %q, got %q", td.expected, e.String())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|