(t *testing.T)
| 60 | } |
| 61 | |
| 62 | func Test_runUnblockCmd_dryRunJSON(t *testing.T) { |
| 63 | r := httpmock.Registry{} |
| 64 | r.Register( |
| 65 | httpmock.REST("GET", "api/1/crawlers/my-crawler"), |
| 66 | httpmock.JSONResponse(crawler.Crawler{ |
| 67 | ID: "my-crawler", |
| 68 | Name: "My crawler", |
| 69 | BlockingTaskID: "task-123", |
| 70 | BlockingError: "crawler is blocked", |
| 71 | }), |
| 72 | ) |
| 73 | defer r.Verify(t) |
| 74 | |
| 75 | f, out := test.NewFactory(false, &r, nil, "") |
| 76 | cmd := NewUnblockCmd(f, nil) |
| 77 | |
| 78 | out, err := test.Execute(cmd, "my-crawler --dry-run --output json", out) |
| 79 | if err != nil { |
| 80 | t.Fatal(err) |
| 81 | } |
| 82 | |
| 83 | assert.Contains(t, out.String(), `"action":"unblock_crawler"`) |
| 84 | assert.Contains(t, out.String(), `"id":"my-crawler"`) |
| 85 | assert.Contains(t, out.String(), `"blockingError":"crawler is blocked"`) |
| 86 | assert.Contains(t, out.String(), `"dryRun":true`) |
| 87 | } |
nothing calls this directly
no test coverage detected