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