(t *testing.T)
| 449 | } |
| 450 | |
| 451 | func Test_GetTeamMembers(t *testing.T) { |
| 452 | t.Parallel() |
| 453 | |
| 454 | serverTool := GetTeamMembers(translations.NullTranslationHelper) |
| 455 | tool := serverTool.Tool |
| 456 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 457 | |
| 458 | assert.Equal(t, "get_team_members", tool.Name) |
| 459 | assert.True(t, tool.Annotations.ReadOnlyHint, "get_team_members tool should be read-only") |
| 460 | |
| 461 | mockTeamMembersResponse := githubv4mock.DataResponse(map[string]any{ |
| 462 | "organization": map[string]any{ |
| 463 | "team": map[string]any{ |
| 464 | "members": map[string]any{ |
| 465 | "nodes": []map[string]any{ |
| 466 | { |
| 467 | "login": "user1", |
| 468 | }, |
| 469 | { |
| 470 | "login": "user2", |
| 471 | }, |
| 472 | }, |
| 473 | }, |
| 474 | }, |
| 475 | }, |
| 476 | }) |
| 477 | |
| 478 | mockNoMembersResponse := githubv4mock.DataResponse(map[string]any{ |
| 479 | "organization": map[string]any{ |
| 480 | "team": map[string]any{ |
| 481 | "members": map[string]any{ |
| 482 | "nodes": []map[string]any{}, |
| 483 | }, |
| 484 | }, |
| 485 | }, |
| 486 | }) |
| 487 | |
| 488 | // Create GQL clients for different test scenarios |
| 489 | gqlClientWithMembers := func() *githubv4.Client { |
| 490 | queryStr := "query($org:String!$teamSlug:String!){organization(login: $org){team(slug: $teamSlug){members(first: 100){nodes{login}}}}}" |
| 491 | vars := map[string]any{ |
| 492 | "org": "testorg", |
| 493 | "teamSlug": "testteam", |
| 494 | } |
| 495 | matcher := githubv4mock.NewQueryMatcher(queryStr, vars, mockTeamMembersResponse) |
| 496 | httpClient := githubv4mock.NewMockedHTTPClient(matcher) |
| 497 | return githubv4.NewClient(httpClient) |
| 498 | } |
| 499 | |
| 500 | gqlClientNoMembers := func() *githubv4.Client { |
| 501 | queryStr := "query($org:String!$teamSlug:String!){organization(login: $org){team(slug: $teamSlug){members(first: 100){nodes{login}}}}}" |
| 502 | vars := map[string]any{ |
| 503 | "org": "testorg", |
| 504 | "teamSlug": "emptyteam", |
| 505 | } |
| 506 | matcher := githubv4mock.NewQueryMatcher(queryStr, vars, mockNoMembersResponse) |
| 507 | httpClient := githubv4mock.NewMockedHTTPClient(matcher) |
| 508 | return githubv4.NewClient(httpClient) |
nothing calls this directly
no test coverage detected