Test that RepoMetadata only fetches teams if the input specifies it
(t *testing.T)
| 477 | |
| 478 | // Test that RepoMetadata only fetches teams if the input specifies it |
| 479 | func 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 | |
| 515 | func Test_ProjectNamesToPaths(t *testing.T) { |
| 516 | t.Run("when projectsV1 is supported, requests them", func(t *testing.T) { |
nothing calls this directly
no test coverage detected