MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestHTTPClient_NetworkError

Function TestHTTPClient_NetworkError

pkg/api/http_test.go:367–376  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

365}
366
367func TestHTTPClient_NetworkError(t *testing.T) {
368 // Use invalid URL to simulate network error
369 client := NewHTTPClient(&http.Client{Timeout: 1 * time.Second}, "http://invalid-host.local", testutils.NewTestLogger())
370
371 var result map[string]interface{}
372 err := client.Get(context.Background(), "/test", &result)
373
374 require.Error(t, err)
375 assert.Contains(t, err.Error(), "request failed")
376}
377
378func TestHTTPClient_ContextCancellation(t *testing.T) {
379 // Create server that delays response to test context cancellation

Callers

nothing calls this directly

Calls 4

GetMethod · 0.95
NewTestLoggerFunction · 0.92
NewHTTPClientFunction · 0.85
ErrorMethod · 0.65

Tested by

no test coverage detected