summaryrefslogtreecommitdiff
path: root/app/controllers/sessions/controller_test.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-17 13:31:33 -0600
committermo khan <mo@mokhan.ca>2025-04-17 13:31:33 -0600
commitc6a5a47f05d92e4ca1089b8d0fe35b4a550d605b (patch)
tree6bdec3b5176478abb1bd4da8234ea10c92061bc9 /app/controllers/sessions/controller_test.go
parentb1b0c09fff9fe20aeb3146658d3cfd8f83c900b0 (diff)
test: extract method to generate a valid authorization code grant
Diffstat (limited to 'app/controllers/sessions/controller_test.go')
-rw-r--r--app/controllers/sessions/controller_test.go9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/controllers/sessions/controller_test.go b/app/controllers/sessions/controller_test.go
index a5167cc..160594b 100644
--- a/app/controllers/sessions/controller_test.go
+++ b/app/controllers/sessions/controller_test.go
@@ -5,9 +5,7 @@ import (
"encoding/json"
"net/http"
"net/url"
- "strconv"
"testing"
- "time"
"github.com/oauth2-proxy/mockoidc"
"github.com/stretchr/testify/assert"
@@ -71,13 +69,8 @@ func TestSessions(t *testing.T) {
})
t.Run("with a valid authorization code grant", func(t *testing.T) {
- code := strconv.FormatInt(time.Now().Unix(), 10)
user := mockoidc.DefaultUser()
- srv.QueueUser(user)
- srv.QueueCode(code)
-
- _, err := http.Get(srv.AuthCodeURL("state"))
- require.NoError(srv, err)
+ code := srv.CreateAuthorizationCodeFor(user)
r, w := test.RequestResponse("GET", "/session/callback?code="+code)