cli/command: TestGetDefaultAuthConfig: remove unused expectedErr
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Родитель
dfec976e84
Коммит
7db922cf9f
|
@ -29,13 +29,11 @@ func TestGetDefaultAuthConfig(t *testing.T) {
|
|||
testCases := []struct {
|
||||
checkCredStore bool
|
||||
inputServerAddress string
|
||||
expectedErr string
|
||||
expectedAuthConfig registry.AuthConfig
|
||||
}{
|
||||
{
|
||||
checkCredStore: false,
|
||||
inputServerAddress: "",
|
||||
expectedErr: "",
|
||||
expectedAuthConfig: registry.AuthConfig{
|
||||
ServerAddress: "",
|
||||
Username: "",
|
||||
|
@ -45,19 +43,16 @@ func TestGetDefaultAuthConfig(t *testing.T) {
|
|||
{
|
||||
checkCredStore: true,
|
||||
inputServerAddress: testAuthConfigs[0].ServerAddress,
|
||||
expectedErr: "",
|
||||
expectedAuthConfig: testAuthConfigs[0],
|
||||
},
|
||||
{
|
||||
checkCredStore: true,
|
||||
inputServerAddress: testAuthConfigs[1].ServerAddress,
|
||||
expectedErr: "",
|
||||
expectedAuthConfig: testAuthConfigs[1],
|
||||
},
|
||||
{
|
||||
checkCredStore: true,
|
||||
inputServerAddress: fmt.Sprintf("https://%s", testAuthConfigs[1].ServerAddress),
|
||||
expectedErr: "",
|
||||
expectedAuthConfig: testAuthConfigs[1],
|
||||
},
|
||||
}
|
||||
|
@ -68,13 +63,8 @@ func TestGetDefaultAuthConfig(t *testing.T) {
|
|||
for _, tc := range testCases {
|
||||
serverAddress := tc.inputServerAddress
|
||||
authconfig, err := command.GetDefaultAuthConfig(cfg, tc.checkCredStore, serverAddress, serverAddress == "https://index.docker.io/v1/")
|
||||
if tc.expectedErr != "" {
|
||||
assert.Check(t, err != nil)
|
||||
assert.Check(t, is.Equal(tc.expectedErr, err.Error()))
|
||||
} else {
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.DeepEqual(tc.expectedAuthConfig, authconfig))
|
||||
}
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.DeepEqual(tc.expectedAuthConfig, authconfig))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче