From 1ba622a4e1fbd3c19f14fa1594a87773faa02000 Mon Sep 17 00:00:00 2001 From: tanuki884 Date: Thu, 21 Jul 2022 17:24:34 +0900 Subject: [PATCH] fix lint error --- pkg/cookies/cookies_test.go | 28 ++++++++++++++-------------- pkg/encryption/utils_test.go | 7 +++---- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/pkg/cookies/cookies_test.go b/pkg/cookies/cookies_test.go index 7c9b408cf9..7a47e6d515 100644 --- a/pkg/cookies/cookies_test.go +++ b/pkg/cookies/cookies_test.go @@ -83,17 +83,17 @@ var _ = Describe("Cookie Tests", func() { Context("MakeCookieFromOptions", func() { type MakeCookieFromOptionsTableInput struct { host string - name string - value string - opts options.Cookie - expiration time.Duration - now time.Time + name string + value string + opts options.Cookie + expiration time.Duration + now time.Time expectedOutput time.Time } validName := "_oauth2_proxy" validSecret := "secretthirtytwobytes+abcdefghijk" - domains := []string{"a.localhost"} + domains := []string{"a.localhost"} now := time.Now() expectedExpires, e := time.Parse("", "0001-01-01T00:00:00Z") @@ -113,8 +113,8 @@ var _ = Describe("Cookie Tests", func() { Expect(MakeCookieFromOptions(req, in.name, in.value, &in.opts, in.expiration, in.now).Expires).To(Equal(in.expectedOutput)) }, Entry("normal cookie", MakeCookieFromOptionsTableInput{ - host: "a.localhost", - name: validName, + host: "a.localhost", + name: validName, value: "1", opts: options.Cookie{ Name: validName, @@ -127,13 +127,13 @@ var _ = Describe("Cookie Tests", func() { HTTPOnly: false, SameSite: "", }, - expiration: 15 * time.Minute, - now: now, + expiration: 15 * time.Minute, + now: now, expectedOutput: now.Add(15 * time.Minute), }), Entry("session cookie", MakeCookieFromOptionsTableInput{ - host: "a.localhost", - name: validName, + host: "a.localhost", + name: validName, value: "1", opts: options.Cookie{ Name: validName, @@ -146,8 +146,8 @@ var _ = Describe("Cookie Tests", func() { HTTPOnly: false, SameSite: "", }, - expiration: 0, - now: now, + expiration: 0, + now: now, expectedOutput: expectedExpires, }), ) diff --git a/pkg/encryption/utils_test.go b/pkg/encryption/utils_test.go index 859c06a4f0..405a13f1f4 100644 --- a/pkg/encryption/utils_test.go +++ b/pkg/encryption/utils_test.go @@ -5,11 +5,11 @@ import ( "crypto/sha1" "crypto/sha256" "encoding/base64" - "net/http" "fmt" "io" - "time" + "net/http" "testing" + "time" "github.com/stretchr/testify/assert" ) @@ -117,9 +117,8 @@ func TestValidate(t *testing.T) { Value: value + "|" + epoch + "|" + sha256sig, } + validValue, timestamp, ok := Validate(cookie, seed, 0) - validValue, timestamp, ok := Validate(cookie, seed, 0); - expectedValue, err := base64.URLEncoding.DecodeString(value) assert.NoError(t, err) assert.Equal(t, validValue, expectedValue)