MCPcopy
hub / github.com/github/github-mcp-server / TestFetcher_ContextCancellation

Function TestFetcher_ContextCancellation

pkg/scopes/fetcher_test.go:222–237  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

220}
221
222func TestFetcher_ContextCancellation(t *testing.T) {
223 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
224 time.Sleep(100 * time.Millisecond)
225 w.WriteHeader(http.StatusOK)
226 }))
227 defer server.Close()
228
229 apiHost := testAPIHostResolver{baseURL: server.URL}
230 fetcher := NewFetcher(apiHost, FetcherOptions{})
231
232 ctx, cancel := context.WithCancel(context.Background())
233 cancel() // Cancel immediately
234
235 _, err := fetcher.FetchTokenScopes(ctx, "test-token")
236 require.Error(t, err)
237}

Callers

nothing calls this directly

Calls 5

FetchTokenScopesMethod · 0.95
NewFetcherFunction · 0.85
WriteHeaderMethod · 0.80
CloseMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected