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

Function TestGetCrawlerUser_HTTPErrorInvalidJSON

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

Source from the content-addressed store, hash-verified

633}
634
635func TestGetCrawlerUser_HTTPErrorInvalidJSON(t *testing.T) {
636 mux := http.NewServeMux()
637 mux.HandleFunc("/1/crawler/user", func(w http.ResponseWriter, r *http.Request) {
638 w.WriteHeader(http.StatusForbidden)
639 _, err := w.Write([]byte(`{"message":`))
640 require.NoError(t, err)
641 })
642
643 ts, client := newTestClient(mux)
644 defer ts.Close()
645
646 _, err := client.GetCrawlerUser("test-token")
647 require.Error(t, err)
648 assert.Contains(t, err.Error(), "failed to parse crawler response")
649}

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected