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

Function NewClientWithMockGHClient

pkg/cmd/attestation/api/client_test.go:17–43  ·  view source on GitHub ↗
(hasNextPage bool)

Source from the content-addressed store, hash-verified

15)
16
17func NewClientWithMockGHClient(hasNextPage bool) Client {
18 fetcher := mockDataGenerator{
19 NumUserAttestations: 5,
20 NumGitHubAttestations: 4,
21 }
22 l := io.NewTestHandler()
23
24 httpClient := &mockHttpClient{}
25
26 if hasNextPage {
27 return &LiveClient{
28 githubAPI: mockAPIClient{
29 OnRESTWithNext: fetcher.OnRESTSuccessWithNextPage,
30 },
31 externalHttpClient: httpClient,
32 logger: l,
33 }
34 }
35
36 return &LiveClient{
37 githubAPI: mockAPIClient{
38 OnRESTWithNext: fetcher.OnRESTSuccess,
39 },
40 externalHttpClient: httpClient,
41 logger: l,
42 }
43}
44
45var testFetchParamsWithOwner = FetchParams{
46 Digest: testDigest,

Callers 1

TestGetByDigestFunction · 0.85

Calls 1

NewTestHandlerFunction · 0.92

Tested by

no test coverage detected