MCPcopy
hub / github.com/ory/hydra / TestHandlerConsent

Function TestHandlerConsent

oauth2/handler_fallback_endpoints_test.go:22–42  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestHandlerConsent(t *testing.T) {
23 t.Parallel()
24
25 reg := testhelpers.NewRegistryMemory(t, driver.WithConfigOptions(configx.WithValue(config.KeyScopeStrategy, "DEPRECATED_HIERARCHICAL_SCOPE_STRATEGY")))
26
27 h := oauth2.NewHandler(reg)
28 r := httprouterx.NewTestRouterAdminWithPrefix(t)
29 h.SetPublicRoutes(r.ToPublic(), func(h http.Handler) http.Handler { return h })
30 h.SetAdminRoutes(r)
31 ts := httptest.NewServer(r)
32 defer ts.Close()
33
34 res, err := http.Get(ts.URL + oauth2.DefaultConsentPath)
35 assert.Nil(t, err)
36 defer res.Body.Close() //nolint:errcheck
37
38 body, err := io.ReadAll(res.Body)
39 assert.Nil(t, err)
40
41 assert.NotEmpty(t, body)
42}

Callers

nothing calls this directly

Calls 8

SetPublicRoutesMethod · 0.95
SetAdminRoutesMethod · 0.95
NewRegistryMemoryFunction · 0.92
WithConfigOptionsFunction · 0.92
NewHandlerFunction · 0.92
ToPublicMethod · 0.80
CloseMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected