(t *testing.T)
| 268 | } |
| 269 | |
| 270 | func Test_ActionsGet_GetWorkflowRun(t *testing.T) { |
| 271 | toolDef := ActionsGet(translations.NullTranslationHelper) |
| 272 | |
| 273 | t.Run("successful workflow run get", func(t *testing.T) { |
| 274 | mockedClient := MockHTTPClientWithHandlers(map[string]http.HandlerFunc{ |
| 275 | GetReposActionsRunsByOwnerByRepoByRunID: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 276 | run := &github.WorkflowRun{ |
| 277 | ID: github.Ptr(int64(12345)), |
| 278 | Name: github.Ptr("CI"), |
| 279 | Status: github.Ptr("completed"), |
| 280 | Conclusion: github.Ptr("success"), |
| 281 | } |
| 282 | w.WriteHeader(http.StatusOK) |
| 283 | _ = json.NewEncoder(w).Encode(run) |
| 284 | }), |
| 285 | }) |
| 286 | |
| 287 | client := mustNewGHClient(t, mockedClient) |
| 288 | deps := BaseDeps{ |
| 289 | Client: client, |
| 290 | } |
| 291 | handler := toolDef.Handler(deps) |
| 292 | |
| 293 | request := createMCPRequest(map[string]any{ |
| 294 | "method": "get_workflow_run", |
| 295 | "owner": "owner", |
| 296 | "repo": "repo", |
| 297 | "resource_id": "12345", |
| 298 | }) |
| 299 | result, err := handler(ContextWithDeps(context.Background(), deps), &request) |
| 300 | |
| 301 | require.NoError(t, err) |
| 302 | require.False(t, result.IsError) |
| 303 | |
| 304 | textContent := getTextResult(t, result) |
| 305 | var response github.WorkflowRun |
| 306 | err = json.Unmarshal([]byte(textContent.Text), &response) |
| 307 | require.NoError(t, err) |
| 308 | assert.NotNil(t, response.ID) |
| 309 | assert.Equal(t, int64(12345), *response.ID) |
| 310 | }) |
| 311 | } |
| 312 | |
| 313 | func Test_ActionsRunTrigger(t *testing.T) { |
| 314 | // Verify tool definition once |
nothing calls this directly
no test coverage detected