(t *testing.T)
| 225 | } |
| 226 | |
| 227 | func Test_ActionsGet_GetWorkflow(t *testing.T) { |
| 228 | toolDef := ActionsGet(translations.NullTranslationHelper) |
| 229 | |
| 230 | t.Run("successful workflow get", func(t *testing.T) { |
| 231 | mockedClient := MockHTTPClientWithHandlers(map[string]http.HandlerFunc{ |
| 232 | GetReposActionsWorkflowsByOwnerByRepoByWorkflowID: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 233 | workflow := &github.Workflow{ |
| 234 | ID: github.Ptr(int64(1)), |
| 235 | Name: github.Ptr("CI"), |
| 236 | Path: github.Ptr(".github/workflows/ci.yml"), |
| 237 | State: github.Ptr("active"), |
| 238 | } |
| 239 | w.WriteHeader(http.StatusOK) |
| 240 | _ = json.NewEncoder(w).Encode(workflow) |
| 241 | }), |
| 242 | }) |
| 243 | |
| 244 | client := mustNewGHClient(t, mockedClient) |
| 245 | deps := BaseDeps{ |
| 246 | Client: client, |
| 247 | } |
| 248 | handler := toolDef.Handler(deps) |
| 249 | |
| 250 | request := createMCPRequest(map[string]any{ |
| 251 | "method": "get_workflow", |
| 252 | "owner": "owner", |
| 253 | "repo": "repo", |
| 254 | "resource_id": "ci.yml", |
| 255 | }) |
| 256 | result, err := handler(ContextWithDeps(context.Background(), deps), &request) |
| 257 | |
| 258 | require.NoError(t, err) |
| 259 | require.False(t, result.IsError) |
| 260 | |
| 261 | textContent := getTextResult(t, result) |
| 262 | var response github.Workflow |
| 263 | err = json.Unmarshal([]byte(textContent.Text), &response) |
| 264 | require.NoError(t, err) |
| 265 | assert.NotNil(t, response.ID) |
| 266 | assert.Equal(t, "CI", *response.Name) |
| 267 | }) |
| 268 | } |
| 269 | |
| 270 | func Test_ActionsGet_GetWorkflowRun(t *testing.T) { |
| 271 | toolDef := ActionsGet(translations.NullTranslationHelper) |
nothing calls this directly
no test coverage detected