mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
wincred: don't use un-keyed literals in test-tables
Also moving the comments into the test-tables. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@@ -91,17 +91,25 @@ func TestWinCredHelper(t *testing.T) {
|
||||
// through variations on the URL
|
||||
func TestWinCredHelperRetrieveAliases(t *testing.T) {
|
||||
tests := []struct {
|
||||
doc string
|
||||
storeURL string
|
||||
readURL string
|
||||
}{
|
||||
// stored with port, retrieved without
|
||||
{"https://foobar.docker.io:2376", "https://foobar.docker.io"},
|
||||
|
||||
// stored as https, retrieved without scheme
|
||||
{"https://foobar.docker.io", "foobar.docker.io"},
|
||||
|
||||
// stored with path, retrieved without
|
||||
{"https://foobar.docker.io/one/two", "https://foobar.docker.io"},
|
||||
{
|
||||
doc: "stored with port, retrieved without",
|
||||
storeURL: "https://foobar.docker.io:2376",
|
||||
readURL: "https://foobar.docker.io",
|
||||
},
|
||||
{
|
||||
doc: "stored as https, retrieved without scheme",
|
||||
storeURL: "https://foobar.docker.io",
|
||||
readURL: "foobar.docker.io",
|
||||
},
|
||||
{
|
||||
doc: "stored with path, retrieved without",
|
||||
storeURL: "https://foobar.docker.io/one/two",
|
||||
readURL: "https://foobar.docker.io",
|
||||
},
|
||||
}
|
||||
|
||||
helper := Wincred{}
|
||||
@@ -133,26 +141,42 @@ func TestWinCredHelperRetrieveAliases(t *testing.T) {
|
||||
// returned.
|
||||
func TestWinCredHelperRetrieveStrict(t *testing.T) {
|
||||
tests := []struct {
|
||||
doc string
|
||||
storeURL string
|
||||
readURL string
|
||||
}{
|
||||
// stored as https, retrieved using http
|
||||
{"https://foobar.docker.io:2376", "http://foobar.docker.io:2376"},
|
||||
|
||||
// stored as http, retrieved using https
|
||||
{"http://foobar.docker.io:2376", "https://foobar.docker.io:2376"},
|
||||
|
||||
// same: stored as http, retrieved without a scheme specified (hence, using the default https://)
|
||||
{"http://foobar.docker.io", "foobar.docker.io:5678"},
|
||||
|
||||
// non-matching ports
|
||||
{"https://foobar.docker.io:1234", "https://foobar.docker.io:5678"},
|
||||
|
||||
// non-matching ports TODO is this desired behavior? The other way round does work
|
||||
// {"https://foobar.docker.io", "https://foobar.docker.io:5678"},
|
||||
|
||||
// non-matching paths
|
||||
{"https://foobar.docker.io:1234/one/two", "https://foobar.docker.io:1234/five/six"},
|
||||
{
|
||||
doc: "stored as https, retrieved using http",
|
||||
storeURL: "https://foobar.docker.io:2376",
|
||||
readURL: "http://foobar.docker.io:2376",
|
||||
},
|
||||
{
|
||||
doc: "stored as http, retrieved using https",
|
||||
storeURL: "http://foobar.docker.io:2376",
|
||||
readURL: "https://foobar.docker.io:2376",
|
||||
},
|
||||
{
|
||||
// stored as http, retrieved without a scheme specified (hence, using the default https://)
|
||||
doc: "stored as http, retrieved without scheme",
|
||||
storeURL: "http://foobar.docker.io",
|
||||
readURL: "foobar.docker.io:5678",
|
||||
},
|
||||
{
|
||||
doc: "non-matching ports",
|
||||
storeURL: "https://foobar.docker.io:1234",
|
||||
readURL: "https://foobar.docker.io:5678",
|
||||
},
|
||||
// TODO: is this desired behavior? The other way round does work
|
||||
// {
|
||||
// doc: "non-matching ports (stored without port)",
|
||||
// storeURL: "https://foobar.docker.io",
|
||||
// readURL: "https://foobar.docker.io:5678",
|
||||
// },
|
||||
{
|
||||
doc: "non-matching paths",
|
||||
storeURL: "https://foobar.docker.io:1234/one/two",
|
||||
readURL: "https://foobar.docker.io:1234/five/six",
|
||||
},
|
||||
}
|
||||
|
||||
helper := Wincred{}
|
||||
|
||||
Reference in New Issue
Block a user