MCPcopy Index your code
hub / github.com/github/github-mcp-server / newMockGQLClient

Function newMockGQLClient

pkg/lockdown/lockdown_test.go:58–85  ·  view source on GitHub ↗
(viewerLogin string, isPrivate bool)

Source from the content-addressed store, hash-verified

56}
57
58func newMockGQLClient(viewerLogin string, isPrivate bool) (*githubv4.Client, *countingTransport) {
59 variables := map[string]any{
60 "owner": githubv4.String(testOwner),
61 "name": githubv4.String(testRepo),
62 }
63
64 httpClient := githubv4mock.NewMockedHTTPClient(
65 githubv4mock.NewQueryMatcher(
66 viewerLoginQuery{},
67 nil,
68 githubv4mock.DataResponse(map[string]any{
69 "viewer": map[string]any{"login": viewerLogin},
70 }),
71 ),
72 githubv4mock.NewQueryMatcher(
73 repoAccessQuery{},
74 variables,
75 githubv4mock.DataResponse(map[string]any{
76 "viewer": map[string]any{"login": viewerLogin},
77 "repository": map[string]any{"isPrivate": isPrivate},
78 }),
79 ),
80 )
81 counting := &countingTransport{next: httpClient.Transport}
82 httpClient.Transport = counting
83 gqlClient := githubv4.NewClient(httpClient)
84 return gqlClient, counting
85}
86
87func newMockRESTServer(t *testing.T, permission string) *gogithub.Client {
88 t.Helper()

Calls 4

NewMockedHTTPClientFunction · 0.92
NewQueryMatcherFunction · 0.92
DataResponseFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected