| 1 | package httpagent |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/mesos/mesos-go/api/v1/lib/agent" |
| 7 | ) |
| 8 | |
| 9 | func TestClassifyResponse(t *testing.T) { |
| 10 | _, err := classifyResponse(nil) |
| 11 | if err == nil { |
| 12 | t.Fatal("expected error instead of nil") |
| 13 | } |
| 14 | for _, v := range agent.Call_Type_value { |
| 15 | ct := agent.Call_Type(v) |
| 16 | _, err = classifyResponse(&agent.Call{Type: ct}) |
| 17 | if ct == agent.Call_UNKNOWN { |
| 18 | if err == nil { |
| 19 | t.Fatal("expected error instead of nil") |
| 20 | } |
| 21 | } else { |
| 22 | if err != nil { |
| 23 | t.Fatalf("unexpected error %v", err) |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | } |