cli/command: TestGetDefaultAuthConfig: remove unused expectedErr

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 7db922cf9f)
Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
Sebastiaan van Stijn 2024-06-10 20:53:13 +02:00 committed by Cory Snider
parent 416c061000
commit abf372a871
1 changed files with 2 additions and 12 deletions

View File

@ -45,13 +45,11 @@ func TestGetDefaultAuthConfig(t *testing.T) {
testCases := []struct { testCases := []struct {
checkCredStore bool checkCredStore bool
inputServerAddress string inputServerAddress string
expectedErr string
expectedAuthConfig types.AuthConfig expectedAuthConfig types.AuthConfig
}{ }{
{ {
checkCredStore: false, checkCredStore: false,
inputServerAddress: "", inputServerAddress: "",
expectedErr: "",
expectedAuthConfig: types.AuthConfig{ expectedAuthConfig: types.AuthConfig{
ServerAddress: "", ServerAddress: "",
Username: "", Username: "",
@ -61,19 +59,16 @@ func TestGetDefaultAuthConfig(t *testing.T) {
{ {
checkCredStore: true, checkCredStore: true,
inputServerAddress: testAuthConfigs[0].ServerAddress, inputServerAddress: testAuthConfigs[0].ServerAddress,
expectedErr: "",
expectedAuthConfig: testAuthConfigs[0], expectedAuthConfig: testAuthConfigs[0],
}, },
{ {
checkCredStore: true, checkCredStore: true,
inputServerAddress: testAuthConfigs[1].ServerAddress, inputServerAddress: testAuthConfigs[1].ServerAddress,
expectedErr: "",
expectedAuthConfig: testAuthConfigs[1], expectedAuthConfig: testAuthConfigs[1],
}, },
{ {
checkCredStore: true, checkCredStore: true,
inputServerAddress: fmt.Sprintf("https://%s", testAuthConfigs[1].ServerAddress), inputServerAddress: fmt.Sprintf("https://%s", testAuthConfigs[1].ServerAddress),
expectedErr: "",
expectedAuthConfig: testAuthConfigs[1], expectedAuthConfig: testAuthConfigs[1],
}, },
} }
@ -87,14 +82,9 @@ func TestGetDefaultAuthConfig(t *testing.T) {
for _, tc := range testCases { for _, tc := range testCases {
serverAddress := tc.inputServerAddress serverAddress := tc.inputServerAddress
authconfig, err := command.GetDefaultAuthConfig(cli, tc.checkCredStore, serverAddress, serverAddress == "https://index.docker.io/v1/") authconfig, err := command.GetDefaultAuthConfig(cli, 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.NilError(t, err)
assert.Check(t, is.DeepEqual(tc.expectedAuthConfig, authconfig)) assert.Check(t, is.DeepEqual(tc.expectedAuthConfig, authconfig))
} }
}
} }
func TestGetDefaultAuthConfig_HelperError(t *testing.T) { func TestGetDefaultAuthConfig_HelperError(t *testing.T) {