(t *testing.T)
| 336 | } |
| 337 | |
| 338 | func TestUpdateApplication_ErrorStatus(t *testing.T) { |
| 339 | mux := http.NewServeMux() |
| 340 | mux.HandleFunc("/1/applications/APP1", func(w http.ResponseWriter, r *http.Request) { |
| 341 | w.WriteHeader(http.StatusUnprocessableEntity) |
| 342 | _, err := w.Write([]byte(`{"errors":[{"title":"name has already been taken"}]}`)) |
| 343 | require.NoError(t, err) |
| 344 | }) |
| 345 | |
| 346 | ts, client := newTestClient(mux) |
| 347 | defer ts.Close() |
| 348 | |
| 349 | _, err := client.UpdateApplication("test-token", "APP1", "Taken Name") |
| 350 | require.Error(t, err) |
| 351 | assert.Contains(t, err.Error(), "update application failed with status 422") |
| 352 | assert.Contains(t, err.Error(), "name has already been taken") |
| 353 | } |
| 354 | |
| 355 | func TestGetSelfServePlans_Success(t *testing.T) { |
| 356 | mux := http.NewServeMux() |
nothing calls this directly
no test coverage detected