MCPcopy Create free account
hub / github.com/algolia/cli / TestUpdateApplication_ErrorStatus

Function TestUpdateApplication_ErrorStatus

api/dashboard/client_test.go:338–353  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

336}
337
338func 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
355func TestGetSelfServePlans_Success(t *testing.T) {
356 mux := http.NewServeMux()

Callers

nothing calls this directly

Calls 4

newTestClientFunction · 0.85
UpdateApplicationMethod · 0.80
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected