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

Function TestHTTPClient_Delete_Success

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

Source from the content-addressed store, hash-verified

223}
224
225func TestHTTPClient_Delete_Success(t *testing.T) {
226 // Create test server
227 server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
228 assert.Equal(t, "DELETE", r.Method)
229
230 response := map[string]interface{}{"deleted": true}
231
232 w.Header().Set("Content-Type", "application/json")
233 _ = json.NewEncoder(w).Encode(response)
234 }))
235 defer server.Close()
236
237 client := NewHTTPClient(server.Client(), server.URL, testutils.NewTestLogger())
238
239 var result map[string]interface{}
240 err := client.Delete(context.Background(), "/test", &result)
241
242 require.NoError(t, err)
243 assert.True(t, result["deleted"].(bool))
244}
245
246func TestHTTPClient_PathHandling(t *testing.T) {
247 tests := []struct {

Callers

nothing calls this directly

Calls 7

DeleteMethod · 0.95
NewTestLoggerFunction · 0.92
NewHTTPClientFunction · 0.85
HeaderMethod · 0.80
ClientMethod · 0.80
SetMethod · 0.65
CloseMethod · 0.65

Tested by

no test coverage detected