summaryrefslogtreecommitdiff
path: root/app/controllers/sessions/controller_test.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-30 12:18:33 -0600
committermo khan <mo@mokhan.ca>2025-04-30 12:18:33 -0600
commitea841ab274630cff287a586d9799663a28c708fc (patch)
tree098cac4dd73524fd3d702e2e7535ad694be48b6c /app/controllers/sessions/controller_test.go
parent6dc20979d287652a849e32696fe3a805df1001ae (diff)
refactor: extract Option[T] and cleaner API for creating cookies
Diffstat (limited to 'app/controllers/sessions/controller_test.go')
-rw-r--r--app/controllers/sessions/controller_test.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/app/controllers/sessions/controller_test.go b/app/controllers/sessions/controller_test.go
index 9ece4f9..c16c6cd 100644
--- a/app/controllers/sessions/controller_test.go
+++ b/app/controllers/sessions/controller_test.go
@@ -6,7 +6,6 @@ import (
"net/http"
"net/url"
"testing"
- "time"
"github.com/oauth2-proxy/mockoidc"
"github.com/stretchr/testify/assert"
@@ -93,7 +92,7 @@ func TestSessions(t *testing.T) {
r, w := test.RequestResponse(
"GET",
"/session/callback?code="+code+"&state=invalid",
- test.WithCookie(cookie.New("oauth_state", nonce, time.Now().Add(10*time.Minute))),
+ test.WithCookie(cookie.New("oauth_state", nonce)),
)
mux.ServeHTTP(w, r)
@@ -117,7 +116,7 @@ func TestSessions(t *testing.T) {
r, w := test.RequestResponse(
"GET",
"/session/callback?code="+code+"&state="+nonce,
- test.WithCookie(cookie.New("oauth_state", nonce, time.Now().Add(10*time.Minute))),
+ test.WithCookie(cookie.New("oauth_state", nonce)),
)
mux.ServeHTTP(w, r)
@@ -175,7 +174,7 @@ func TestSessions(t *testing.T) {
t.Run("POST /session/destroy", func(t *testing.T) {
t.Run("clears the session cookie", func(t *testing.T) {
- cookie := cookie.New("session", "value", time.Now().Add(5*time.Minute))
+ cookie := cookie.New("session", "value")
r, w := test.RequestResponse("POST", "/session/destroy", test.WithCookie(cookie))
mux.ServeHTTP(w, r)