diff --git a/cli/config/config_test.go b/cli/config/config_test.go index 85288291b4..404ed94004 100644 --- a/cli/config/config_test.go +++ b/cli/config/config_test.go @@ -150,9 +150,8 @@ func TestOldValidAuth(t *testing.T) { // defaultIndexserver is https://index.docker.io/v1/ ac := config.AuthConfigs["https://index.docker.io/v1/"] - if ac.Username != "joejoe" || ac.Password != "hello" { - t.Fatalf("Missing data from parsing:\n%q", config) - } + assert.Equal(t, ac.Username, "joejoe") + assert.Equal(t, ac.Password, "hello") // Now save it and make sure it shows up in new form configStr := saveConfigAndValidateNewFormat(t, config, tmpHome) @@ -213,9 +212,8 @@ func TestOldJSON(t *testing.T) { assert.NilError(t, err) ac := config.AuthConfigs["https://index.docker.io/v1/"] - if ac.Username != "joejoe" || ac.Password != "hello" { - t.Fatalf("Missing data from parsing:\n%q", config) - } + assert.Equal(t, ac.Username, "joejoe") + assert.Equal(t, ac.Password, "hello") // Now save it and make sure it shows up in new form configStr := saveConfigAndValidateNewFormat(t, config, tmpHome) @@ -249,9 +247,8 @@ func TestNewJSON(t *testing.T) { assert.NilError(t, err) ac := config.AuthConfigs["https://index.docker.io/v1/"] - if ac.Username != "joejoe" || ac.Password != "hello" { - t.Fatalf("Missing data from parsing:\n%q", config) - } + assert.Equal(t, ac.Username, "joejoe") + assert.Equal(t, ac.Password, "hello") // Now save it and make sure it shows up in new form configStr := saveConfigAndValidateNewFormat(t, config, tmpHome) @@ -284,9 +281,8 @@ func TestNewJSONNoEmail(t *testing.T) { assert.NilError(t, err) ac := config.AuthConfigs["https://index.docker.io/v1/"] - if ac.Username != "joejoe" || ac.Password != "hello" { - t.Fatalf("Missing data from parsing:\n%q", config) - } + assert.Equal(t, ac.Username, "joejoe") + assert.Equal(t, ac.Password, "hello") // Now save it and make sure it shows up in new form configStr := saveConfigAndValidateNewFormat(t, config, tmpHome) @@ -431,10 +427,8 @@ func TestJSONReaderNoFile(t *testing.T) { assert.NilError(t, err) ac := config.AuthConfigs["https://index.docker.io/v1/"] - if ac.Username != "joejoe" || ac.Password != "hello" { - t.Fatalf("Missing data from parsing:\n%q", config) - } - + assert.Equal(t, ac.Username, "joejoe") + assert.Equal(t, ac.Password, "hello") } func TestOldJSONReaderNoFile(t *testing.T) { @@ -444,9 +438,8 @@ func TestOldJSONReaderNoFile(t *testing.T) { assert.NilError(t, err) ac := config.AuthConfigs["https://index.docker.io/v1/"] - if ac.Username != "joejoe" || ac.Password != "hello" { - t.Fatalf("Missing data from parsing:\n%q", config) - } + assert.Equal(t, ac.Username, "joejoe") + assert.Equal(t, ac.Password, "hello") } func TestJSONWithPsFormatNoFile(t *testing.T) {