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

Function Test_RepoMetadata_TeamsAreConditionallyFetched

api/queries_repo_test.go:479–513  ·  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

477
478// Test that RepoMetadata only fetches teams if the input specifies it
479func Test_RepoMetadata_TeamsAreConditionallyFetched(t *testing.T) {
480 http := &httpmock.Registry{}
481 client := newTestClient(http)
482 repo, _ := ghrepo.FromFullName("OWNER/REPO")
483 input := RepoMetadataInput{
484 Reviewers: true,
485 TeamReviewers: false, // Do not fetch teams
486 }
487
488 http.Register(
489 httpmock.GraphQL(`query RepositoryAssignableUsers\b`),
490 httpmock.StringResponse(`
491 { "data": { "repository": { "assignableUsers": {
492 "nodes": [
493 { "login": "hubot", "id": "HUBOTID" },
494 { "login": "MonaLisa", "id": "MONAID" }
495 ],
496 "pageInfo": { "hasNextPage": false }
497 } } } }
498 `))
499
500 http.Register(
501 httpmock.GraphQL(`query UserCurrent\b`),
502 httpmock.StringResponse(`
503 { "data": { "viewer": { "login": "monalisa" } } }
504 `))
505
506 http.Exclude(
507 t,
508 httpmock.GraphQL(`query OrganizationTeamList\b`),
509 )
510
511 _, err := RepoMetadata(client, repo, input)
512 require.NoError(t, err)
513}
514
515func Test_ProjectNamesToPaths(t *testing.T) {
516 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