mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
Cleanup original modifications to the exposed APIs
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
This commit is contained in:
@@ -16,7 +16,7 @@ func (h Wincred) Add(creds *credentials.Credentials) error {
|
||||
g.UserName = creds.Username
|
||||
g.CredentialBlob = []byte(creds.Secret)
|
||||
g.Persist = winc.PersistLocalMachine
|
||||
g.Attributes = []winc.CredentialAttribute{{"label", []byte(creds.Label)}}
|
||||
g.Attributes = []winc.CredentialAttribute{{"label", []byte(credentials.CredsLabel)}}
|
||||
|
||||
return g.Write()
|
||||
}
|
||||
@@ -43,7 +43,7 @@ func (h Wincred) Get(serverURL string) (string, string, error) {
|
||||
}
|
||||
|
||||
// List returns the stored URLs and corresponding usernames for a given credentials label.
|
||||
func (h Wincred) List(credsLabel string) (map[string]string, error) {
|
||||
func (h Wincred) List() (map[string]string, error) {
|
||||
creds, err := winc.List()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -8,13 +8,11 @@ import (
|
||||
|
||||
func TestWinCredHelper(t *testing.T) {
|
||||
creds := &credentials.Credentials{
|
||||
Label: credentials.CredsLabel,
|
||||
ServerURL: "https://foobar.docker.io:2376/v1",
|
||||
Username: "foobar",
|
||||
Secret: "foobarbaz",
|
||||
}
|
||||
creds1 := &credentials.Credentials{
|
||||
Label: credentials.CredsLabel,
|
||||
ServerURL: "https://foobar.docker.io:2376/v2",
|
||||
Username: "foobarbaz",
|
||||
Secret: "foobar",
|
||||
@@ -38,14 +36,14 @@ func TestWinCredHelper(t *testing.T) {
|
||||
t.Fatalf("expected %s, got %s\n", "foobarbaz", secret)
|
||||
}
|
||||
|
||||
auths, err := helper.List(credentials.CredsLabel)
|
||||
auths, err := helper.List()
|
||||
if err != nil || len(auths) == 0 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
helper.Add(creds1)
|
||||
defer helper.Delete(creds1.ServerURL)
|
||||
newauths, err := helper.List(credentials.CredsLabel)
|
||||
newauths, err := helper.List()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user