Skip to content

Commit

Permalink
Remove usage of chi in test.
Browse files Browse the repository at this point in the history
  • Loading branch information
kennyp committed Mar 15, 2024
1 parent 91aad96 commit 1d91d86
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions dynoid/middleware/dynoid_test.go
Expand Up @@ -8,21 +8,15 @@ import (
"net/http/httptest"
"testing"

"github.com/go-chi/chi"

"github.com/heroku/x/dynoid"
"github.com/heroku/x/dynoid/dynoidtest"
"github.com/heroku/x/dynoid/middleware"
)

var noOp = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})

func TestAuthorize(t *testing.T) {
router := chi.NewRouter()
router.Use(middleware.Authorize(
dynoidtest.Audience,
dynoid.AllowHerokuHost(dynoidtest.IssuerHost),
))
router.Get("/", func(w http.ResponseWriter, r *http.Request) {
})
handler := middleware.Authorize(dynoidtest.Audience, dynoid.AllowHerokuHost(dynoidtest.IssuerHost))(noOp)

ctx, generate := newTokenGenerator(t)

Expand All @@ -44,7 +38,7 @@ func TestAuthorize(t *testing.T) {
r.Header.Add("Authorization", tc.AuthorizationHeader)
}

router.ServeHTTP(w, r)
handler.ServeHTTP(w, r)

resp := w.Result()
body, err := io.ReadAll(resp.Body)
Expand Down

0 comments on commit 1d91d86

Please sign in to comment.