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

Function NewClientWithMockGHClient

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

Source from the content-addressed store, hash-verified

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

Callers 1

TestGetByDigestFunction · 0.85

Calls 1

NewTestHandlerFunction · 0.92

Tested by

no test coverage detected