(t *testing.T)
| 546 | } |
| 547 | |
| 548 | func Test_ActionsGetJobLogs_SingleJob(t *testing.T) { |
| 549 | toolDef := ActionsGetJobLogs(translations.NullTranslationHelper) |
| 550 | |
| 551 | t.Run("successful single job logs with URL", func(t *testing.T) { |
| 552 | mockedClient := MockHTTPClientWithHandlers(map[string]http.HandlerFunc{ |
| 553 | GetReposActionsJobsLogsByOwnerByRepoByJobID: http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) { |
| 554 | w.Header().Set("Location", "https://github.com/logs/job/123") |
| 555 | w.WriteHeader(http.StatusFound) |
| 556 | }), |
| 557 | }) |
| 558 | |
| 559 | client := mustNewGHClient(t, mockedClient) |
| 560 | deps := BaseDeps{ |
| 561 | Client: client, |
| 562 | ContentWindowSize: 5000, |
| 563 | } |
| 564 | handler := toolDef.Handler(deps) |
| 565 | |
| 566 | request := createMCPRequest(map[string]any{ |
| 567 | "owner": "owner", |
| 568 | "repo": "repo", |
| 569 | "job_id": float64(123), |
| 570 | }) |
| 571 | result, err := handler(ContextWithDeps(context.Background(), deps), &request) |
| 572 | |
| 573 | require.NoError(t, err) |
| 574 | require.False(t, result.IsError) |
| 575 | |
| 576 | textContent := getTextResult(t, result) |
| 577 | var response map[string]any |
| 578 | err = json.Unmarshal([]byte(textContent.Text), &response) |
| 579 | require.NoError(t, err) |
| 580 | assert.Equal(t, float64(123), response["job_id"]) |
| 581 | assert.Contains(t, response, "logs_url") |
| 582 | assert.Equal(t, "Job logs are available for download", response["message"]) |
| 583 | }) |
| 584 | } |
| 585 | |
| 586 | func Test_ActionsGetJobLogs_FailedJobs(t *testing.T) { |
| 587 | toolDef := ActionsGetJobLogs(translations.NullTranslationHelper) |
nothing calls this directly
no test coverage detected