(t *testing.T)
| 525 | } |
| 526 | |
| 527 | func TestChangeApplicationPlan_ErrorStatus(t *testing.T) { |
| 528 | mux := http.NewServeMux() |
| 529 | mux.HandleFunc( |
| 530 | "/1/applications/APP1/plan/self-serve", |
| 531 | func(w http.ResponseWriter, r *http.Request) { |
| 532 | w.WriteHeader(http.StatusUnprocessableEntity) |
| 533 | _, err := w.Write([]byte(`{"errors":[{"title":"plan change not allowed"}]}`)) |
| 534 | require.NoError(t, err) |
| 535 | }, |
| 536 | ) |
| 537 | |
| 538 | ts, client := newTestClient(mux) |
| 539 | defer ts.Close() |
| 540 | |
| 541 | _, err := client.ChangeApplicationPlan("test-token", "APP1", "grow") |
| 542 | require.Error(t, err) |
| 543 | assert.Contains(t, err.Error(), "Couldn't change your application's plan: 422") |
| 544 | // The response body must never be surfaced in the error, only the status. |
| 545 | assert.NotContains(t, err.Error(), "plan change not allowed") |
| 546 | } |
| 547 | |
| 548 | func TestGetCrawlerUser_Success(t *testing.T) { |
| 549 | mux := http.NewServeMux() |
nothing calls this directly
no test coverage detected