MCPcopy Create free account
hub / github.com/openclaw/gogcli / newDocsServiceForTest

Function newDocsServiceForTest

internal/cmd/docs_testutil_test.go:132–146  ·  view source on GitHub ↗
(t *testing.T, h http.HandlerFunc)

Source from the content-addressed store, hash-verified

130}
131
132func newDocsServiceForTest(t *testing.T, h http.HandlerFunc) (*docs.Service, func()) {
133 t.Helper()
134
135 srv := httptest.NewServer(h)
136 t.Cleanup(srv.Close)
137 docSvc, err := docs.NewService(context.Background(),
138 option.WithoutAuthentication(),
139 option.WithHTTPClient(srv.Client()),
140 option.WithEndpoint(srv.URL+"/"),
141 )
142 if err != nil {
143 t.Fatalf("NewDocsService: %v", err)
144 }
145 return docSvc, func() {} // retained for call-site compat; cleanup is via t.Cleanup
146}
147
148func withDocsTestService(ctx context.Context, svc *docs.Service) context.Context {
149 return withDocsTestServiceFactory(ctx, func(context.Context, string) (*docs.Service, error) {

Calls 1

CleanupMethod · 0.80

Tested by

no test coverage detected