MCPcopy
hub / github.com/dosco/graphjin / newSourceModeJWTHTTPTestHandler

Function newSourceModeJWTHTTPTestHandler

serv/source_mode_http_test.go:199–220  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

197}
198
199func newSourceModeJWTHTTPTestHandler(t *testing.T) http.Handler {
200 t.Helper()
201
202 dbPath := createSourceModeHTTPDB(t)
203 svc := newControlPlaneGraphQLTestServiceWithConfig(t, MCPConfig{}, dbPath, func(conf *Config) {
204 conf.Core.Mode = modeAgentic
205 conf.Core.Roles = append(conf.Core.Roles, core.Role{Name: "member"})
206 conf.Serv.Auth = Auth{
207 Type: "jwt",
208 JWT: JWTConfig{Secret: sourceModeHTTPJWTSecret},
209 }
210 conf.Serv.AuthFailBlock = true
211 })
212
213 ah, err := auth.NewAuthHandlerFunc(svc.conf.Auth)
214 if err != nil {
215 t.Fatalf("new auth handler: %v", err)
216 }
217 hs := &HttpService{}
218 hs.Store(svc)
219 return hs.GraphQL(ah)
220}
221
222func createSourceModeHTTPDB(t *testing.T) string {
223 t.Helper()

Calls 3

GraphQLMethod · 0.95
createSourceModeHTTPDBFunction · 0.85

Tested by

no test coverage detected