MCPcopy Index your code
hub / github.com/coder/coder / fakeOIDCDiscovery

Function fakeOIDCDiscovery

cli/server_fix_oidc_links_test.go:22–36  ·  view source on GitHub ↗

fakeOIDCDiscovery returns a test server serving an OIDC discovery document.

(t *testing.T, issuer string)

Source from the content-addressed store, hash-verified

20
21// fakeOIDCDiscovery returns a test server serving an OIDC discovery document.
22func fakeOIDCDiscovery(t *testing.T, issuer string) *httptest.Server {
23 t.Helper()
24 srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
25 if r.URL.Path != "/.well-known/openid-configuration" {
26 http.NotFound(w, r)
27 return
28 }
29 w.Header().Set("Content-Type", "application/json")
30 _ = json.NewEncoder(w).Encode(map[string]string{
31 "issuer": issuer,
32 })
33 }))
34 t.Cleanup(srv.Close)
35 return srv
36}
37
38func TestFixOIDCLinks(t *testing.T) {
39 t.Parallel()

Callers 1

TestFixOIDCLinksFunction · 0.85

Calls 5

EncodeMethod · 0.80
HelperMethod · 0.65
SetMethod · 0.65
CleanupMethod · 0.65
HeaderMethod · 0.45

Tested by

no test coverage detected