Test that RepoMetadata only fetches teams if the input specifies it
(t *testing.T)
| 466 | |
| 467 | // Test that RepoMetadata only fetches teams if the input specifies it |
| 468 | func Test_RepoMetadata_TeamsAreConditionallyFetched(t *testing.T) { |
| 469 | http := &httpmock.Registry{} |
| 470 | client := newTestClient(http) |
| 471 | repo, _ := ghrepo.FromFullName("OWNER/REPO") |
| 472 | input := RepoMetadataInput{ |
| 473 | Reviewers: true, |
| 474 | TeamReviewers: false, // Do not fetch teams |
| 475 | } |
| 476 | |
| 477 | http.Register( |
| 478 | httpmock.GraphQL(`query RepositoryAssignableUsers\b`), |
| 479 | httpmock.StringResponse(` |
| 480 | { "data": { "repository": { "assignableUsers": { |
| 481 | "nodes": [ |
| 482 | { "login": "hubot", "id": "HUBOTID" }, |
| 483 | { "login": "MonaLisa", "id": "MONAID" } |
| 484 | ], |
| 485 | "pageInfo": { "hasNextPage": false } |
| 486 | } } } } |
| 487 | `)) |
| 488 | |
| 489 | http.Register( |
| 490 | httpmock.GraphQL(`query UserCurrent\b`), |
| 491 | httpmock.StringResponse(` |
| 492 | { "data": { "viewer": { "login": "monalisa" } } } |
| 493 | `)) |
| 494 | |
| 495 | http.Exclude( |
| 496 | t, |
| 497 | httpmock.GraphQL(`query OrganizationTeamList\b`), |
| 498 | ) |
| 499 | |
| 500 | _, err := RepoMetadata(client, repo, input) |
| 501 | require.NoError(t, err) |
| 502 | } |
| 503 | |
| 504 | func Test_ProjectNamesToPaths(t *testing.T) { |
| 505 | t.Run("when projectsV1 is supported, requests them", func(t *testing.T) { |
nothing calls this directly
no test coverage detected