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

Function Test_apiRun_DELETE

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

Source from the content-addressed store, hash-verified

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