diff options
author | Miloslav Trmač <mitr@redhat.com> | 2021-09-11 22:20:26 +0200 |
---|---|---|
committer | Miloslav Trmač <mitr@redhat.com> | 2021-12-10 18:16:18 +0100 |
commit | 7674f2f76b07058aa3bbf44675b7c2482c61811a (patch) | |
tree | 04b2e0e22ff805f1a610589fe51f462df64338ed /pkg/auth/auth_test.go | |
parent | 2aeb690d370de9fee15fc7c47b66fb04a30c41d8 (diff) | |
download | podman-7674f2f76b07058aa3bbf44675b7c2482c61811a.tar.gz podman-7674f2f76b07058aa3bbf44675b7c2482c61811a.tar.bz2 podman-7674f2f76b07058aa3bbf44675b7c2482c61811a.zip |
Simplify the interface of parseSingleAuthHeader
Don't create a single-element map only for the only caller
to laboriously extract an element of that map; just return
a single entry.
Should not change behavior.
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'pkg/auth/auth_test.go')
-rw-r--r-- | pkg/auth/auth_test.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/pkg/auth/auth_test.go b/pkg/auth/auth_test.go index 634215acf..0e6bd42ef 100644 --- a/pkg/auth/auth_test.go +++ b/pkg/auth/auth_test.go @@ -302,24 +302,22 @@ func TestParseSingleAuthHeader(t *testing.T) { for _, tc := range []struct { input string shouldErr bool - expected map[string]types.DockerAuthConfig + expected types.DockerAuthConfig }{ { input: "", // An empty (or missing) header - expected: map[string]types.DockerAuthConfig{"0": {}}, + expected: types.DockerAuthConfig{}, }, { input: "null", - expected: map[string]types.DockerAuthConfig{"0": {}}, + expected: types.DockerAuthConfig{}, }, // Invalid JSON {input: "@", shouldErr: true}, // Success { - input: base64.URLEncoding.EncodeToString([]byte(`{"username":"u1","password":"p1"}`)), - expected: map[string]types.DockerAuthConfig{ - "0": {Username: "u1", Password: "p1"}, - }, + input: base64.URLEncoding.EncodeToString([]byte(`{"username":"u1","password":"p1"}`)), + expected: types.DockerAuthConfig{Username: "u1", Password: "p1"}, }, } { req, err := http.NewRequest(http.MethodPost, "/", nil) |