MCPcopy Create free account
hub / github.com/compozy/agh / TestClientRateLimitExceeded

Function TestClientRateLimitExceeded

internal/registry/github/client_test.go:376–393  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

374}
375
376func TestClientRateLimitExceeded(t *testing.T) {
377 t.Parallel()
378
379 server := newGitHubServer(t, func(writer http.ResponseWriter, _ *http.Request) {
380 writer.Header().Set("X-RateLimit-Remaining", "0")
381 http.Error(writer, `{"message":"API rate limit exceeded"}`, http.StatusForbidden)
382 })
383 defer server.Close()
384
385 client := NewClient(server.URL)
386 _, err := client.Info(context.Background(), "acme/demo")
387 if err == nil {
388 t.Fatal("Info() error = nil, want rate-limit failure")
389 }
390 if !strings.Contains(err.Error(), "GITHUB_TOKEN") {
391 t.Fatalf("Info() error = %v, want GITHUB_TOKEN hint", err)
392 }
393}
394
395func TestClientPrivateRepositoryRequiresToken(t *testing.T) {
396 t.Parallel()

Callers

nothing calls this directly

Calls 7

InfoMethod · 0.95
newGitHubServerFunction · 0.85
ContainsMethod · 0.80
NewClientFunction · 0.70
CloseMethod · 0.65
SetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected