MCPcopy
hub / github.com/github/github-mcp-server / Test_GetTeams

Function Test_GetTeams

pkg/github/context_tools_test.go:208–449  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

206}
207
208func Test_GetTeams(t *testing.T) {
209 t.Parallel()
210
211 serverTool := GetTeams(translations.NullTranslationHelper)
212 tool := serverTool.Tool
213 require.NoError(t, toolsnaps.Test(tool.Name, tool))
214
215 assert.Equal(t, "get_teams", tool.Name)
216 assert.True(t, tool.Annotations.ReadOnlyHint, "get_teams tool should be read-only")
217
218 mockUser := &github.User{
219 Login: github.Ptr("testuser"),
220 Name: github.Ptr("Test User"),
221 Email: github.Ptr("test@example.com"),
222 Bio: github.Ptr("GitHub user for testing"),
223 Company: github.Ptr("Test Company"),
224 Location: github.Ptr("Test Location"),
225 HTMLURL: github.Ptr("https://github.com/testuser"),
226 CreatedAt: &github.Timestamp{Time: time.Now().Add(-365 * 24 * time.Hour)},
227 Type: github.Ptr("User"),
228 Hireable: github.Ptr(true),
229 TwitterUsername: github.Ptr("testuser_twitter"),
230 Plan: &github.Plan{
231 Name: github.Ptr("pro"),
232 },
233 }
234
235 mockTeamsResponse := githubv4mock.DataResponse(map[string]any{
236 "user": map[string]any{
237 "organizations": map[string]any{
238 "nodes": []map[string]any{
239 {
240 "login": "testorg1",
241 "teams": map[string]any{
242 "nodes": []map[string]any{
243 {
244 "name": "team1",
245 "slug": "team1",
246 "description": "Team 1",
247 },
248 {
249 "name": "team2",
250 "slug": "team2",
251 "description": "Team 2",
252 },
253 },
254 },
255 },
256 {
257 "login": "testorg2",
258 "teams": map[string]any{
259 "nodes": []map[string]any{
260 {
261 "name": "team3",
262 "slug": "team3",
263 "description": "Team 3",
264 },
265 },

Callers

nothing calls this directly

Calls 15

TestFunction · 0.92
DataResponseFunction · 0.92
NewQueryMatcherFunction · 0.92
NewMockedHTTPClientFunction · 0.92
GetTeamsFunction · 0.85
mockResponseFunction · 0.85
badRequestHandlerFunction · 0.85
mustNewGHClientFunction · 0.85
stubClientFnErrFunction · 0.85
stubExportersFunction · 0.85
stubClientFnFromHTTPFunction · 0.85

Tested by

no test coverage detected