MCPcopy Index your code
hub / github.com/github/github-mcp-server / Test_GetIssue_FieldValues

Function Test_GetIssue_FieldValues

pkg/github/issues_test.go:397–467  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

395}
396
397func Test_GetIssue_FieldValues(t *testing.T) {
398 // The raw REST issue_field_values are always cleared. Enriched field_values are
399 // only populated via GraphQL when the issue has a node ID; this issue has none,
400 // so field_values stays empty.
401 serverTool := IssueRead(translations.NullTranslationHelper)
402
403 mockIssueWithFields := &github.Issue{
404 Number: github.Ptr(99),
405 Title: github.Ptr("Issue with field values"),
406 Body: github.Ptr("body"),
407 State: github.Ptr("open"),
408 HTMLURL: github.Ptr("https://github.com/owner/repo/issues/99"),
409 User: &github.User{
410 Login: github.Ptr("testuser"),
411 },
412 IssueFieldValues: []*github.IssueFieldValue{
413 {
414 IssueFieldID: 1001,
415 NodeID: "FV_node_1",
416 DataType: "single_select",
417 Value: "High",
418 SingleSelectOption: &github.IssueFieldValueSingleSelectOption{
419 ID: 42,
420 Name: "High",
421 Color: "red",
422 },
423 },
424 {
425 IssueFieldID: 1002,
426 NodeID: "FV_node_2",
427 DataType: "text",
428 Value: "some text value",
429 },
430 },
431 }
432
433 mockedClient := MockHTTPClientWithHandlers(map[string]http.HandlerFunc{
434 GetReposIssuesByOwnerByRepoByIssueNumber: mockResponse(t, http.StatusOK, mockIssueWithFields),
435 })
436
437 cache := stubRepoAccessCache(nil, 15*time.Minute)
438 flags := stubFeatureFlags(map[string]bool{"lockdown-mode": false})
439 deps := BaseDeps{
440 Client: mustNewGHClient(t, mockedClient),
441 GQLClient: defaultGQLClient,
442 RepoAccessCache: cache,
443 Flags: flags,
444 }
445 handler := serverTool.Handler(deps)
446
447 request := createMCPRequest(map[string]any{
448 "method": "get",
449 "owner": "owner",
450 "repo": "repo",
451 "issue_number": float64(99),
452 })
453 result, err := handler(ContextWithDeps(context.Background(), deps), &request)
454 require.NoError(t, err)

Callers

nothing calls this directly

Calls 10

IssueReadFunction · 0.85
mockResponseFunction · 0.85
stubRepoAccessCacheFunction · 0.85
stubFeatureFlagsFunction · 0.85
mustNewGHClientFunction · 0.85
createMCPRequestFunction · 0.85
ContextWithDepsFunction · 0.85
getTextResultFunction · 0.85
HandlerMethod · 0.45

Tested by

no test coverage detected