summaryrefslogtreecommitdiff
path: root/pkg/auth/auth_test.go
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2021-09-11 22:28:24 +0200
committerMiloslav Trmač <mitr@redhat.com>2021-12-10 18:16:19 +0100
commit1ecc6ba72852700f748715124bdf98573cc93c0b (patch)
treea4beeecde21ece45280e1fea35cb6130eb97fe58 /pkg/auth/auth_test.go
parent6f1a26b04f9a35a649f80c07be2e3372bc65d60a (diff)
downloadpodman-1ecc6ba72852700f748715124bdf98573cc93c0b.tar.gz
podman-1ecc6ba72852700f748715124bdf98573cc93c0b.tar.bz2
podman-1ecc6ba72852700f748715124bdf98573cc93c0b.zip
Pass a header value directly to parseSingleAuthHeader and parseMultiAuthHeader
Both have a single caller, so there's no point in looking up the header value twice. 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.go10
1 files changed, 2 insertions, 8 deletions
diff --git a/pkg/auth/auth_test.go b/pkg/auth/auth_test.go
index 0e6bd42ef..6acf1f8fb 100644
--- a/pkg/auth/auth_test.go
+++ b/pkg/auth/auth_test.go
@@ -320,10 +320,7 @@ func TestParseSingleAuthHeader(t *testing.T) {
expected: types.DockerAuthConfig{Username: "u1", Password: "p1"},
},
} {
- req, err := http.NewRequest(http.MethodPost, "/", nil)
- require.NoError(t, err, tc.input)
- req.Header.Set(XRegistryAuthHeader.String(), tc.input)
- res, err := parseSingleAuthHeader(req)
+ res, err := parseSingleAuthHeader(tc.input)
if tc.shouldErr {
assert.Error(t, err, tc.input)
} else {
@@ -356,10 +353,7 @@ func TestParseMultiAuthHeader(t *testing.T) {
},
},
} {
- req, err := http.NewRequest(http.MethodPost, "/", nil)
- require.NoError(t, err, tc.input)
- req.Header.Set(XRegistryAuthHeader.String(), tc.input)
- res, err := parseMultiAuthHeader(req)
+ res, err := parseMultiAuthHeader(tc.input)
if tc.shouldErr {
assert.Error(t, err, tc.input)
} else {