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

Function TestClientUsesGitHubToken

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

Source from the content-addressed store, hash-verified

467}
468
469func TestClientUsesGitHubToken(t *testing.T) {
470 t.Setenv("GITHUB_TOKEN", "secret-token")
471 server := newGitHubServer(t, func(writer http.ResponseWriter, request *http.Request) {
472 if got := request.Header.Get("Authorization"); got != "Bearer secret-token" {
473 t.Fatalf("Authorization = %q, want bearer token", got)
474 }
475 writeJSON(
476 writer,
477 `{"tag_name":"v1.2.3","draft":false,"prerelease":false,"tarball_url":"`+serverURLPlaceholder+`/downloads/source.tar.gz","assets":[]}`,
478 )
479 })
480 defer server.Close()
481
482 client := NewClient(server.URL)
483 _, err := client.fetchLatestRelease(context.Background(), repoSlug{owner: "acme", name: "demo", full: "acme/demo"})
484 if err != nil {
485 t.Fatalf("fetchLatestRelease() error = %v", err)
486 }
487}
488
489func TestClientRetriesHTTP500(t *testing.T) {
490 t.Parallel()

Callers

nothing calls this directly

Calls 6

fetchLatestReleaseMethod · 0.95
newGitHubServerFunction · 0.85
writeJSONFunction · 0.70
NewClientFunction · 0.70
GetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected