(t *testing.T)
| 25 | } |
| 26 | |
| 27 | func TestAPIClient_GET(t *testing.T) { |
| 28 | mock := testutil.NewMockAPI() |
| 29 | defer mock.Close() |
| 30 | |
| 31 | fixture := testutil.LoadFixture("monitors_list.json") |
| 32 | mock.On("GET", "/monitors", 200, fixture) |
| 33 | |
| 34 | client := newTestClient(mock.Server.URL) |
| 35 | resp, err := client.GET("/monitors", nil) |
| 36 | if err != nil { |
| 37 | t.Fatalf("unexpected error: %v", err) |
| 38 | } |
| 39 | |
| 40 | if resp.StatusCode != 200 { |
| 41 | t.Errorf("expected status 200, got %d", resp.StatusCode) |
| 42 | } |
| 43 | |
| 44 | req := mock.LastRequest() |
| 45 | if req.Method != "GET" { |
| 46 | t.Errorf("expected GET, got %s", req.Method) |
| 47 | } |
| 48 | if req.Path != "/monitors" { |
| 49 | t.Errorf("expected /monitors, got %s", req.Path) |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | func TestAPIClient_GET_WithQueryParams(t *testing.T) { |
| 54 | mock := testutil.NewMockAPI() |
nothing calls this directly
no test coverage detected