(viewerLogin string, isPrivate bool)
| 56 | } |
| 57 | |
| 58 | func 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 | |
| 87 | func newMockRESTServer(t *testing.T, permission string) *gogithub.Client { |
| 88 | t.Helper() |
no test coverage detected