(t *testing.T, h http.HandlerFunc)
| 130 | } |
| 131 | |
| 132 | func 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 | |
| 148 | func withDocsTestService(ctx context.Context, svc *docs.Service) context.Context { |
| 149 | return withDocsTestServiceFactory(ctx, func(context.Context, string) (*docs.Service, error) { |
no test coverage detected