mirror of https://github.com/docker/cli.git
Add test case to cover non-empty auth entry
Signed-off-by: Jon Johnson <jonjohnson@google.com>
This commit is contained in:
parent
37e9cabf11
commit
415f608620
|
@ -389,23 +389,31 @@ func TestLoadFromReaderWithUsernamePassword(t *testing.T) {
|
||||||
Username: "user",
|
Username: "user",
|
||||||
Password: "pass",
|
Password: "pass",
|
||||||
}
|
}
|
||||||
cf := ConfigFile{
|
|
||||||
AuthConfigs: map[string]types.AuthConfig{
|
for _, tc := range []types.AuthConfig{
|
||||||
"example.com/foo": want,
|
want,
|
||||||
|
types.AuthConfig{
|
||||||
|
Auth: encodeAuth(&want),
|
||||||
},
|
},
|
||||||
|
} {
|
||||||
|
cf := ConfigFile{
|
||||||
|
AuthConfigs: map[string]types.AuthConfig{
|
||||||
|
"example.com/foo": tc,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
b, err := json.Marshal(cf)
|
||||||
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
err = configFile.LoadFromReader(bytes.NewReader(b))
|
||||||
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
got, err := configFile.GetAuthConfig("example.com/foo")
|
||||||
|
assert.NilError(t, err)
|
||||||
|
|
||||||
|
assert.Check(t, is.DeepEqual(want.Username, got.Username))
|
||||||
|
assert.Check(t, is.DeepEqual(want.Password, got.Password))
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := json.Marshal(cf)
|
|
||||||
assert.NilError(t, err)
|
|
||||||
|
|
||||||
err = configFile.LoadFromReader(bytes.NewReader(b))
|
|
||||||
assert.NilError(t, err)
|
|
||||||
|
|
||||||
got, err := configFile.GetAuthConfig("example.com/foo")
|
|
||||||
assert.NilError(t, err)
|
|
||||||
|
|
||||||
assert.Check(t, is.DeepEqual(want.Username, got.Username))
|
|
||||||
assert.Check(t, is.DeepEqual(want.Password, got.Password))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckKubernetesConfigurationRaiseAnErrorOnInvalidValue(t *testing.T) {
|
func TestCheckKubernetesConfigurationRaiseAnErrorOnInvalidValue(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue