Skip to content

Commit

Permalink
Merged main
Browse files Browse the repository at this point in the history
  • Loading branch information
corbadoman committed Oct 17, 2024
2 parents 08e5b71 + 4b8828f commit f3a08d8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/unit/session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"encoding/json"
"io"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -82,17 +83,13 @@ func newSession(issuer string) (*session.Impl, error) {
}
})

server := &http.Server{Addr: "localhost:8081", Handler: mockServer} // nolint:gosec
go func() {
if err := server.ListenAndServe(); err != nil {
panic(err)
}
}()
server := httptest.NewServer(mockServer)
defer server.Close()

// Config
config := &session.Config{
ProjectID: "pro-1",
JwksURI: "http://localhost:8081",
JwksURI: server.URL,
JWTIssuer: issuer,
}

Expand Down Expand Up @@ -127,7 +124,7 @@ func newSession(issuer string) (*session.Impl, error) {
RefreshUnknownKID: true,
}

jwks, err := keyfunc.Get("http://localhost:8081", options)
jwks, err := keyfunc.Get(server.URL, options)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit f3a08d8

Please sign in to comment.