MCPcopy Index your code
hub / github.com/cli/cli / TestGetBundle

Function TestGetBundle

pkg/cmd/attestation/api/client_test.go:256–268  ·  view source on GitHub ↗

getBundle successfully fetches a bundle on the first HTTP request attempt

(t *testing.T)

Source from the content-addressed store, hash-verified

254
255// getBundle successfully fetches a bundle on the first HTTP request attempt
256func TestGetBundle(t *testing.T) {
257 mockHTTPClient := &mockHttpClient{}
258
259 c := &LiveClient{
260 externalHttpClient: mockHTTPClient,
261 logger: io.NewTestHandler(),
262 }
263
264 b, err := c.getBundle("https://mybundleurl.com")
265 require.NoError(t, err)
266 require.Equal(t, "application/vnd.dev.sigstore.bundle.v0.3+json", b.GetMediaType())
267 mockHTTPClient.AssertNumberOfCalls(t, "OnGetSuccess", 1)
268}
269
270// getBundle retries successfully when the initial HTTP request returns
271// a 5XX status code

Callers

nothing calls this directly

Calls 3

getBundleMethod · 0.95
NewTestHandlerFunction · 0.92
EqualMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…