Merge pull request #6366 from thaJeztah/fix_email_deprecation
cli/config/types: update deprecation comment for AuthConfig.Email
This commit is contained in:
@ -43,13 +43,13 @@ func TestFileStoreIdempotent(t *testing.T) {
|
||||
},
|
||||
})
|
||||
authOne := types.AuthConfig{
|
||||
Username: "foo@example.com",
|
||||
Auth: "super_secret_token",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: "https://example.com",
|
||||
}
|
||||
authTwo := types.AuthConfig{
|
||||
Username: "bar@example.com",
|
||||
Auth: "also_super_secret_token",
|
||||
Email: "bar@example.com",
|
||||
ServerAddress: "https://other.example.com",
|
||||
}
|
||||
|
||||
@ -106,8 +106,8 @@ func TestFileStoreAddCredentials(t *testing.T) {
|
||||
|
||||
s := NewFileStore(f)
|
||||
auth := types.AuthConfig{
|
||||
Username: "foo@example.com",
|
||||
Auth: "super_secret_token",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: "https://example.com",
|
||||
}
|
||||
err := s.Store(auth)
|
||||
@ -122,8 +122,8 @@ func TestFileStoreAddCredentials(t *testing.T) {
|
||||
func TestFileStoreGet(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
"https://example.com": {
|
||||
Username: "foo@example.com",
|
||||
Auth: "super_secret_token",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: "https://example.com",
|
||||
},
|
||||
}}
|
||||
@ -136,8 +136,8 @@ func TestFileStoreGet(t *testing.T) {
|
||||
if a.Auth != "super_secret_token" {
|
||||
t.Fatalf("expected auth `super_secret_token`, got %s", a.Auth)
|
||||
}
|
||||
if a.Email != "foo@example.com" {
|
||||
t.Fatalf("expected email `foo@example.com`, got %s", a.Email)
|
||||
if a.Username != "foo@example.com" {
|
||||
t.Fatalf("expected username `foo@example.com`, got %s", a.Username)
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,13 +146,13 @@ func TestFileStoreGetAll(t *testing.T) {
|
||||
s2 := "https://example2.example.com"
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
s1: {
|
||||
Username: "foo@example.com",
|
||||
Auth: "super_secret_token",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: "https://example.com",
|
||||
},
|
||||
s2: {
|
||||
Username: "foo@example2.com",
|
||||
Auth: "super_secret_token2",
|
||||
Email: "foo@example2.com",
|
||||
ServerAddress: "https://example2.example.com",
|
||||
},
|
||||
}}
|
||||
@ -168,22 +168,22 @@ func TestFileStoreGetAll(t *testing.T) {
|
||||
if as[s1].Auth != "super_secret_token" {
|
||||
t.Fatalf("expected auth `super_secret_token`, got %s", as[s1].Auth)
|
||||
}
|
||||
if as[s1].Email != "foo@example.com" {
|
||||
t.Fatalf("expected email `foo@example.com`, got %s", as[s1].Email)
|
||||
if as[s1].Username != "foo@example.com" {
|
||||
t.Fatalf("expected username `foo@example.com`, got %s", as[s1].Username)
|
||||
}
|
||||
if as[s2].Auth != "super_secret_token2" {
|
||||
t.Fatalf("expected auth `super_secret_token2`, got %s", as[s2].Auth)
|
||||
}
|
||||
if as[s2].Email != "foo@example2.com" {
|
||||
t.Fatalf("expected email `foo@example2.com`, got %s", as[s2].Email)
|
||||
if as[s2].Username != "foo@example2.com" {
|
||||
t.Fatalf("expected username `foo@example2.com`, got %s", as[s2].Username)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileStoreErase(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
"https://example.com": {
|
||||
Username: "foo@example.com",
|
||||
Auth: "super_secret_token",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: "https://example.com",
|
||||
},
|
||||
}}
|
||||
@ -203,9 +203,6 @@ func TestFileStoreErase(t *testing.T) {
|
||||
if a.Auth != "" {
|
||||
t.Fatalf("expected empty auth token, got %s", a.Auth)
|
||||
}
|
||||
if a.Email != "" {
|
||||
t.Fatalf("expected empty email, got %s", a.Email)
|
||||
}
|
||||
}
|
||||
|
||||
func TestConvertToHostname(t *testing.T) {
|
||||
|
||||
@ -99,7 +99,6 @@ func TestNativeStoreAddCredentials(t *testing.T) {
|
||||
auth := types.AuthConfig{
|
||||
Username: "foo",
|
||||
Password: "bar",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: validServerAddress,
|
||||
}
|
||||
err := s.Store(auth)
|
||||
@ -109,7 +108,6 @@ func TestNativeStoreAddCredentials(t *testing.T) {
|
||||
actual, ok := f.GetAuthConfigs()[validServerAddress]
|
||||
assert.Check(t, ok)
|
||||
expected := types.AuthConfig{
|
||||
Email: auth.Email,
|
||||
ServerAddress: auth.ServerAddress,
|
||||
}
|
||||
assert.Check(t, is.DeepEqual(expected, actual))
|
||||
@ -124,7 +122,6 @@ func TestNativeStoreAddInvalidCredentials(t *testing.T) {
|
||||
err := s.Store(types.AuthConfig{
|
||||
Username: "foo",
|
||||
Password: "bar",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: invalidServerAddress,
|
||||
})
|
||||
assert.ErrorContains(t, err, "program failed")
|
||||
@ -134,7 +131,7 @@ func TestNativeStoreAddInvalidCredentials(t *testing.T) {
|
||||
func TestNativeStoreGet(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
validServerAddress: {
|
||||
Email: "foo@example.com",
|
||||
Username: "foo@example.com",
|
||||
},
|
||||
}}
|
||||
s := &nativeStore{
|
||||
@ -147,7 +144,6 @@ func TestNativeStoreGet(t *testing.T) {
|
||||
expected := types.AuthConfig{
|
||||
Username: "foo",
|
||||
Password: "bar",
|
||||
Email: "foo@example.com",
|
||||
ServerAddress: validServerAddress,
|
||||
}
|
||||
assert.Check(t, is.DeepEqual(expected, actual))
|
||||
@ -155,9 +151,7 @@ func TestNativeStoreGet(t *testing.T) {
|
||||
|
||||
func TestNativeStoreGetIdentityToken(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
validServerAddress2: {
|
||||
Email: "foo@example2.com",
|
||||
},
|
||||
validServerAddress2: {},
|
||||
}}
|
||||
|
||||
s := &nativeStore{
|
||||
@ -169,7 +163,6 @@ func TestNativeStoreGetIdentityToken(t *testing.T) {
|
||||
|
||||
expected := types.AuthConfig{
|
||||
IdentityToken: "abcd1234",
|
||||
Email: "foo@example2.com",
|
||||
ServerAddress: validServerAddress2,
|
||||
}
|
||||
assert.Check(t, is.DeepEqual(expected, actual))
|
||||
@ -177,9 +170,7 @@ func TestNativeStoreGetIdentityToken(t *testing.T) {
|
||||
|
||||
func TestNativeStoreGetAll(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
validServerAddress: {
|
||||
Email: "foo@example.com",
|
||||
},
|
||||
validServerAddress: {},
|
||||
}}
|
||||
|
||||
s := &nativeStore{
|
||||
@ -189,38 +180,20 @@ func TestNativeStoreGetAll(t *testing.T) {
|
||||
as, err := s.GetAll()
|
||||
assert.NilError(t, err)
|
||||
assert.Check(t, is.Len(as, 2))
|
||||
|
||||
if as[validServerAddress].Username != "foo" {
|
||||
t.Fatalf("expected username `foo` for %s, got %s", validServerAddress, as[validServerAddress].Username)
|
||||
}
|
||||
if as[validServerAddress].Password != "bar" {
|
||||
t.Fatalf("expected password `bar` for %s, got %s", validServerAddress, as[validServerAddress].Password)
|
||||
}
|
||||
if as[validServerAddress].IdentityToken != "" {
|
||||
t.Fatalf("expected identity to be empty for %s, got %s", validServerAddress, as[validServerAddress].IdentityToken)
|
||||
}
|
||||
if as[validServerAddress].Email != "foo@example.com" {
|
||||
t.Fatalf("expected email `foo@example.com` for %s, got %s", validServerAddress, as[validServerAddress].Email)
|
||||
}
|
||||
if as[validServerAddress2].Username != "" {
|
||||
t.Fatalf("expected username to be empty for %s, got %s", validServerAddress2, as[validServerAddress2].Username)
|
||||
}
|
||||
if as[validServerAddress2].Password != "" {
|
||||
t.Fatalf("expected password to be empty for %s, got %s", validServerAddress2, as[validServerAddress2].Password)
|
||||
}
|
||||
if as[validServerAddress2].IdentityToken != "abcd1234" {
|
||||
t.Fatalf("expected identity token `abcd1324` for %s, got %s", validServerAddress2, as[validServerAddress2].IdentityToken)
|
||||
}
|
||||
if as[validServerAddress2].Email != "" {
|
||||
t.Fatalf("expected no email for %s, got %s", validServerAddress2, as[validServerAddress2].Email)
|
||||
expected := types.AuthConfig{
|
||||
Username: "foo",
|
||||
Password: "bar",
|
||||
ServerAddress: "https://index.docker.io/v1",
|
||||
IdentityToken: "",
|
||||
}
|
||||
actual, ok := as[validServerAddress]
|
||||
assert.Check(t, ok)
|
||||
assert.Check(t, is.DeepEqual(expected, actual))
|
||||
}
|
||||
|
||||
func TestNativeStoreGetMissingCredentials(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
validServerAddress: {
|
||||
Email: "foo@example.com",
|
||||
},
|
||||
validServerAddress: {},
|
||||
}}
|
||||
|
||||
s := &nativeStore{
|
||||
@ -233,9 +206,7 @@ func TestNativeStoreGetMissingCredentials(t *testing.T) {
|
||||
|
||||
func TestNativeStoreGetInvalidAddress(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
validServerAddress: {
|
||||
Email: "foo@example.com",
|
||||
},
|
||||
validServerAddress: {},
|
||||
}}
|
||||
|
||||
s := &nativeStore{
|
||||
@ -248,9 +219,7 @@ func TestNativeStoreGetInvalidAddress(t *testing.T) {
|
||||
|
||||
func TestNativeStoreErase(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
validServerAddress: {
|
||||
Email: "foo@example.com",
|
||||
},
|
||||
validServerAddress: {},
|
||||
}}
|
||||
|
||||
s := &nativeStore{
|
||||
@ -264,9 +233,7 @@ func TestNativeStoreErase(t *testing.T) {
|
||||
|
||||
func TestNativeStoreEraseInvalidAddress(t *testing.T) {
|
||||
f := &fakeStore{configs: map[string]types.AuthConfig{
|
||||
validServerAddress: {
|
||||
Email: "foo@example.com",
|
||||
},
|
||||
validServerAddress: {},
|
||||
}}
|
||||
|
||||
s := &nativeStore{
|
||||
|
||||
@ -7,8 +7,8 @@ type AuthConfig struct {
|
||||
Auth string `json:"auth,omitempty"`
|
||||
|
||||
// Email is an optional value associated with the username.
|
||||
// This field is deprecated and will be removed in a later
|
||||
// version of docker.
|
||||
//
|
||||
// Deprecated: This field is deprecated since docker 1.11 (API v1.23) and will be removed in the next release.
|
||||
Email string `json:"email,omitempty"`
|
||||
|
||||
ServerAddress string `json:"serveraddress,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user