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
|
// through variations on the URL
|
||||||
func TestWinCredHelperRetrieveAliases(t *testing.T) {
|
func TestWinCredHelperRetrieveAliases(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
doc string
|
||||||
storeURL string
|
storeURL string
|
||||||
readURL string
|
readURL string
|
||||||
}{
|
}{
|
||||||
// stored with port, retrieved without
|
{
|
||||||
{"https://foobar.docker.io:2376", "https://foobar.docker.io"},
|
doc: "stored with port, retrieved without",
|
||||||
|
storeURL: "https://foobar.docker.io:2376",
|
||||||
// stored as https, retrieved without scheme
|
readURL: "https://foobar.docker.io",
|
||||||
{"https://foobar.docker.io", "foobar.docker.io"},
|
},
|
||||||
|
{
|
||||||
// stored with path, retrieved without
|
doc: "stored as https, retrieved without scheme",
|
||||||
{"https://foobar.docker.io/one/two", "https://foobar.docker.io"},
|
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{}
|
helper := Wincred{}
|
||||||
@@ -133,26 +141,42 @@ func TestWinCredHelperRetrieveAliases(t *testing.T) {
|
|||||||
// returned.
|
// returned.
|
||||||
func TestWinCredHelperRetrieveStrict(t *testing.T) {
|
func TestWinCredHelperRetrieveStrict(t *testing.T) {
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
|
doc string
|
||||||
storeURL string
|
storeURL string
|
||||||
readURL string
|
readURL string
|
||||||
}{
|
}{
|
||||||
// stored as https, retrieved using http
|
{
|
||||||
{"https://foobar.docker.io:2376", "http://foobar.docker.io:2376"},
|
doc: "stored as https, retrieved using http",
|
||||||
|
storeURL: "https://foobar.docker.io:2376",
|
||||||
// stored as http, retrieved using https
|
readURL: "http://foobar.docker.io:2376",
|
||||||
{"http://foobar.docker.io:2376", "https://foobar.docker.io:2376"},
|
},
|
||||||
|
{
|
||||||
// same: stored as http, retrieved without a scheme specified (hence, using the default https://)
|
doc: "stored as http, retrieved using https",
|
||||||
{"http://foobar.docker.io", "foobar.docker.io:5678"},
|
storeURL: "http://foobar.docker.io:2376",
|
||||||
|
readURL: "https://foobar.docker.io:2376",
|
||||||
// non-matching ports
|
},
|
||||||
{"https://foobar.docker.io:1234", "https://foobar.docker.io:5678"},
|
{
|
||||||
|
// stored as http, retrieved without a scheme specified (hence, using the default https://)
|
||||||
// non-matching ports TODO is this desired behavior? The other way round does work
|
doc: "stored as http, retrieved without scheme",
|
||||||
// {"https://foobar.docker.io", "https://foobar.docker.io:5678"},
|
storeURL: "http://foobar.docker.io",
|
||||||
|
readURL: "foobar.docker.io:5678",
|
||||||
// non-matching paths
|
},
|
||||||
{"https://foobar.docker.io:1234/one/two", "https://foobar.docker.io:1234/five/six"},
|
{
|
||||||
|
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{}
|
helper := Wincred{}
|
||||||
|
|||||||
Reference in New Issue
Block a user