MCPcopy
hub / github.com/cli/cli / Test_RepoMetadata_TeamsAreConditionallyFetched

Function Test_RepoMetadata_TeamsAreConditionallyFetched

api/queries_repo_test.go:385–419  ·  view source on GitHub ↗

Test that RepoMetadata only fetches teams if the input specifies it

(t *testing.T)

Source from the content-addressed store, hash-verified

383
384// Test that RepoMetadata only fetches teams if the input specifies it
385func Test_RepoMetadata_TeamsAreConditionallyFetched(t *testing.T) {
386 http := &httpmock.Registry{}
387 client := newTestClient(http)
388 repo, _ := ghrepo.FromFullName("OWNER/REPO")
389 input := RepoMetadataInput{
390 Reviewers: true,
391 TeamReviewers: false, // Do not fetch teams
392 }
393
394 http.Register(
395 httpmock.GraphQL(`query RepositoryAssignableUsers\b`),
396 httpmock.StringResponse(`
397 { "data": { "repository": { "assignableUsers": {
398 "nodes": [
399 { "login": "hubot", "id": "HUBOTID" },
400 { "login": "MonaLisa", "id": "MONAID" }
401 ],
402 "pageInfo": { "hasNextPage": false }
403 } } } }
404 `))
405
406 http.Register(
407 httpmock.GraphQL(`query UserCurrent\b`),
408 httpmock.StringResponse(`
409 { "data": { "viewer": { "login": "monalisa" } } }
410 `))
411
412 http.Exclude(
413 t,
414 httpmock.GraphQL(`query OrganizationTeamList\b`),
415 )
416
417 _, err := RepoMetadata(client, repo, input)
418 require.NoError(t, err)
419}
420
421func Test_ProjectNamesToPaths(t *testing.T) {
422 t.Run("when projectsV1 is supported, requests them", func(t *testing.T) {

Callers

nothing calls this directly

Calls 7

RegisterMethod · 0.95
ExcludeMethod · 0.95
FromFullNameFunction · 0.92
GraphQLFunction · 0.92
StringResponseFunction · 0.92
newTestClientFunction · 0.85
RepoMetadataFunction · 0.85

Tested by

no test coverage detected