This commit is contained in:
Alex Dadgar 2017-07-20 17:40:45 -07:00
parent 2db57d6351
commit da13d5a61c
1 changed files with 5 additions and 3 deletions

View File

@ -113,16 +113,18 @@ func TestStatusCommand_Run(t *testing.T) {
if !strings.Contains(out, "Created At") {
t.Fatal("should have created header")
}
ui.ErrorWriter.Reset()
ui.OutputWriter.Reset()
// Query jobs with prefix match
if code := cmd.Run([]string{"-address=" + url, "job"}); code != 0 {
t.Fatalf("expected exit 0, got: %d", code)
if code := cmd.Run([]string{"-address=" + url, "job"}); code != 1 {
t.Fatalf("expected exit 1, got: %d", code)
}
out = ui.OutputWriter.String()
out = ui.ErrorWriter.String()
if !strings.Contains(out, "job1_sfx") || !strings.Contains(out, "job2_sfx") {
t.Fatalf("expected job1_sfx and job2_sfx, got: %s", out)
}
ui.ErrorWriter.Reset()
ui.OutputWriter.Reset()
// Query a single job with prefix match