MCPcopy Create free account
hub / github.com/cli/cli / Test_apiRun_DELETE

Function Test_apiRun_DELETE

pkg/cmd/api/api_test.go:1389–1417  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1387}
1388
1389func Test_apiRun_DELETE(t *testing.T) {
1390 ios, _, _, _ := iostreams.Test()
1391
1392 var gotRequest *http.Request
1393 err := apiRun(&ApiOptions{
1394 IO: ios,
1395 Config: func() (gh.Config, error) {
1396 return config.NewMockConfig(), nil
1397 },
1398 HttpClient: func(rootapi.HTTPClientOptions) (*http.Client, error) {
1399 var tr roundTripper = func(req *http.Request) (*http.Response, error) {
1400 gotRequest = req
1401 return &http.Response{StatusCode: 204, Request: req}, nil
1402 }
1403 return &http.Client{Transport: tr}, nil
1404 },
1405 MagicFields: []string(nil),
1406 RawFields: []string(nil),
1407 RequestMethod: "DELETE",
1408 RequestMethodPassed: true,
1409 })
1410 if err != nil {
1411 t.Fatalf("got error %v", err)
1412 }
1413
1414 if gotRequest.Body != nil {
1415 t.Errorf("expected nil request body, got %T", gotRequest.Body)
1416 }
1417}
1418
1419func Test_apiRun_HEAD(t *testing.T) {
1420 ios, _, _, _ := iostreams.Test()

Callers

nothing calls this directly

Calls 4

TestFunction · 0.92
NewMockConfigFunction · 0.92
apiRunFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected