(t *testing.T)
| 108 | } |
| 109 | |
| 110 | func Test_GetIssue(t *testing.T) { |
| 111 | // Verify tool definition once |
| 112 | serverTool := IssueRead(translations.NullTranslationHelper) |
| 113 | tool := serverTool.Tool |
| 114 | require.NoError(t, toolsnaps.Test(tool.Name, tool)) |
| 115 | |
| 116 | assert.Equal(t, "issue_read", tool.Name) |
| 117 | assert.NotEmpty(t, tool.Description) |
| 118 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "method") |
| 119 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner") |
| 120 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo") |
| 121 | assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issue_number") |
| 122 | assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"method", "owner", "repo", "issue_number"}) |
| 123 | |
| 124 | // Setup mock issue for success case |
| 125 | mockIssue := &github.Issue{ |
| 126 | Number: github.Ptr(42), |
| 127 | Title: github.Ptr("Test Issue"), |
| 128 | Body: github.Ptr("This is a test issue"), |
| 129 | State: github.Ptr("open"), |
| 130 | HTMLURL: github.Ptr("https://github.com/owner/repo/issues/42"), |
| 131 | User: &github.User{ |
| 132 | Login: github.Ptr("testuser"), |
| 133 | }, |
| 134 | Repository: &github.Repository{ |
| 135 | Name: github.Ptr("repo"), |
| 136 | Owner: &github.User{ |
| 137 | Login: github.Ptr("owner"), |
| 138 | }, |
| 139 | }, |
| 140 | } |
| 141 | mockIssue2 := &github.Issue{ |
| 142 | Number: github.Ptr(422), |
| 143 | Title: github.Ptr("Test Issue 2"), |
| 144 | Body: github.Ptr("This is a test issue 2"), |
| 145 | State: github.Ptr("open"), |
| 146 | HTMLURL: github.Ptr("https://github.com/owner/repo/issues/42"), |
| 147 | User: &github.User{ |
| 148 | Login: github.Ptr("testuser2"), |
| 149 | }, |
| 150 | Repository: &github.Repository{ |
| 151 | Name: github.Ptr("repo2"), |
| 152 | Owner: &github.User{ |
| 153 | Login: github.Ptr("owner2"), |
| 154 | }, |
| 155 | }, |
| 156 | } |
| 157 | |
| 158 | tests := []struct { |
| 159 | name string |
| 160 | mockedClient *http.Client |
| 161 | requestArgs map[string]any |
| 162 | expectHandlerError bool |
| 163 | expectResultError bool |
| 164 | expectedIssue *github.Issue |
| 165 | expectedErrMsg string |
| 166 | lockdownEnabled bool |
| 167 | restPermission string |
nothing calls this directly
no test coverage detected