1
0
mirror of https://github.com/docker/docker-credential-helpers.git synced 2026-06-13 16:01:28 +05:30

pass: return an error when a cred doesn't exist

fixes https://github.com/docker/docker-credential-helpers/issues/174

Signed-off-by: Nick Santos <nick.santos@docker.com>
This commit is contained in:
Nick Santos
2022-07-27 09:23:46 -04:00
parent e595cd6946
commit 2fc2313bb1
2 changed files with 13 additions and 8 deletions
+12 -7
View File
@@ -54,13 +54,9 @@ func TestPassHelper(t *testing.T) {
t.Fatal(err)
}
username, _, err = helper.Get(server)
if err != nil {
t.Fatal(err)
}
if username != "" {
t.Fatalf("%s shouldn't exist any more", username)
_, _, err = helper.Get(server)
if !credentials.IsErrCredentialsNotFound(err) {
t.Fatalf("expected credentials not found, actual: %v", err)
}
}
@@ -73,3 +69,12 @@ func TestPassHelper(t *testing.T) {
t.Fatal("didn't delete all creds?")
}
}
func TestMissingCred(t *testing.T) {
helper := Pass{}
_, _, err := helper.Get("garbage")
if !credentials.IsErrCredentialsNotFound(err) {
t.Fatalf("expected credentials not found, actual: %v", err)
}
}