MCPcopy Create free account
hub / github.com/cli/cli / TestGetBundle

Function TestGetBundle

pkg/cmd/attestation/api/client_test.go:260–272  ·  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

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

Callers

nothing calls this directly

Calls 4

getBundleMethod · 0.95
NewTestHandlerFunction · 0.92
NewImmutableSafeURLFunction · 0.92
EqualMethod · 0.80

Tested by

no test coverage detected