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

Function TestGetBundle

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

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