Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
tanuki884 authored and t-katsumura committed Oct 3, 2022
1 parent db4cd20 commit 1ba622a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
28 changes: 14 additions & 14 deletions pkg/cookies/cookies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -146,8 +146,8 @@ var _ = Describe("Cookie Tests", func() {
HTTPOnly: false,
SameSite: "",
},
expiration: 0,
now: now,
expiration: 0,
now: now,
expectedOutput: expectedExpires,
}),
)
Expand Down
7 changes: 3 additions & 4 deletions pkg/encryption/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1ba622a

Please sign in to comment.