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

Function Test_UpdateIssue

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

Source from the content-addressed store, hash-verified

2563}
2564
2565func Test_UpdateIssue(t *testing.T) {
2566 // Verify tool definition
2567 serverTool := IssueWrite(translations.NullTranslationHelper)
2568 tool := serverTool.Tool
2569 require.NoError(t, toolsnaps.Test(tool.Name, tool))
2570
2571 assert.Equal(t, "issue_write", tool.Name)
2572 assert.NotEmpty(t, tool.Description)
2573 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "method")
2574 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner")
2575 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo")
2576 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issue_number")
2577 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "title")
2578 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "body")
2579 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "labels")
2580 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "assignees")
2581 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "milestone")
2582 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "type")
2583 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "state")
2584 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "state_reason")
2585 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "duplicate_of")
2586 assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issue_fields")
2587 assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"method", "owner", "repo"})
2588
2589 // Mock issues for reuse across test cases
2590 mockBaseIssue := &github.Issue{
2591 Number: github.Ptr(123),
2592 Title: github.Ptr("Title"),
2593 Body: github.Ptr("Description"),
2594 State: github.Ptr("open"),
2595 HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"),
2596 Assignees: []*github.User{{Login: github.Ptr("assignee1")}, {Login: github.Ptr("assignee2")}},
2597 Labels: []*github.Label{{Name: github.Ptr("bug")}, {Name: github.Ptr("priority")}},
2598 Milestone: &github.Milestone{Number: github.Ptr(5)},
2599 Type: &github.IssueType{Name: github.Ptr("Bug")},
2600 }
2601
2602 mockUpdatedIssue := &github.Issue{
2603 Number: github.Ptr(123),
2604 Title: github.Ptr("Updated Title"),
2605 Body: github.Ptr("Updated Description"),
2606 State: github.Ptr("closed"),
2607 StateReason: github.Ptr("duplicate"),
2608 HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"),
2609 Assignees: []*github.User{{Login: github.Ptr("assignee1")}, {Login: github.Ptr("assignee2")}},
2610 Labels: []*github.Label{{Name: github.Ptr("bug")}, {Name: github.Ptr("priority")}},
2611 Milestone: &github.Milestone{Number: github.Ptr(5)},
2612 Type: &github.IssueType{Name: github.Ptr("Bug")},
2613 }
2614
2615 mockReopenedIssue := &github.Issue{
2616 Number: github.Ptr(123),
2617 Title: github.Ptr("Title"),
2618 State: github.Ptr("open"),
2619 StateReason: github.Ptr("reopened"),
2620 HTMLURL: github.Ptr("https://github.com/owner/repo/issues/123"),
2621 }
2622

Callers

nothing calls this directly

Calls 15

TestFunction · 0.92
DataResponseFunction · 0.92
NewMockedHTTPClientFunction · 0.92
NewQueryMatcherFunction · 0.92
NewMutationMatcherFunction · 0.92
ErrorResponseFunction · 0.92
IssueWriteFunction · 0.85
expectRequestBodyFunction · 0.85
mockResponseFunction · 0.85
mustNewGHClientFunction · 0.85
createMCPRequestFunction · 0.85

Tested by

no test coverage detected