(t *testing.T)
| 307 | } |
| 308 | |
| 309 | func TestAPIClient_403_Forbidden(t *testing.T) { |
| 310 | mock := testutil.NewMockAPI() |
| 311 | defer mock.Close() |
| 312 | |
| 313 | errBody := testutil.LoadFixture("error_responses/403.json") |
| 314 | mock.On("GET", "/monitors", 403, errBody) |
| 315 | |
| 316 | client := newTestClient(mock.Server.URL) |
| 317 | resp, err := client.GET("/monitors", nil) |
| 318 | if err != nil { |
| 319 | t.Fatalf("unexpected error: %v", err) |
| 320 | } |
| 321 | |
| 322 | if resp.StatusCode != 403 { |
| 323 | t.Errorf("expected 403, got %d", resp.StatusCode) |
| 324 | } |
| 325 | |
| 326 | parsed := resp.ParseError() |
| 327 | if !strings.Contains(parsed, "Invalid API key") { |
| 328 | t.Errorf("expected 'Invalid API key', got %q", parsed) |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | func TestAPIClient_404_NotFound(t *testing.T) { |
| 333 | mock := testutil.NewMockAPI() |
nothing calls this directly
no test coverage detected