Files
hanko/backend/handler/well_known_test.go
2025-09-25 19:15:20 +02:00

35 lines
717 B
Go

package handler
import (
"github.com/stretchr/testify/suite"
"github.com/teamhanko/hanko/backend/v2/test"
"net/http"
"net/http/httptest"
"testing"
)
func TestWellKnownSuite(t *testing.T) {
t.Parallel()
suite.Run(t, new(wellKnownSuite))
}
type wellKnownSuite struct {
test.Suite
}
func (s *wellKnownSuite) TestWellKnownHandler_GetPublicKeys() {
if testing.Short() {
s.T().Skip("skipping test in short mode")
}
e := NewPublicRouter(&test.DefaultConfig, s.Storage, nil, nil)
req := httptest.NewRequest(http.MethodGet, "/.well-known/jwks.json", nil)
rec := httptest.NewRecorder()
e.ServeHTTP(rec, req)
s.Equal(http.StatusOK, rec.Code)
s.Equal("max-age=600", rec.Header().Get("Cache-Control"))
}