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

Function Test_apiRun_DELETE

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

Source from the content-addressed store, hash-verified

1285}
1286
1287func Test_apiRun_DELETE(t *testing.T) {
1288 ios, _, _, _ := iostreams.Test()
1289
1290 var gotRequest *http.Request
1291 err := apiRun(&ApiOptions{
1292 IO: ios,
1293 Config: func() (gh.Config, error) {
1294 return config.NewBlankConfig(), nil
1295 },
1296 HttpClient: func() (*http.Client, error) {
1297 var tr roundTripper = func(req *http.Request) (*http.Response, error) {
1298 gotRequest = req
1299 return &http.Response{StatusCode: 204, Request: req}, nil
1300 }
1301 return &http.Client{Transport: tr}, nil
1302 },
1303 MagicFields: []string(nil),
1304 RawFields: []string(nil),
1305 RequestMethod: "DELETE",
1306 RequestMethodPassed: true,
1307 })
1308 if err != nil {
1309 t.Fatalf("got error %v", err)
1310 }
1311
1312 if gotRequest.Body != nil {
1313 t.Errorf("expected nil request body, got %T", gotRequest.Body)
1314 }
1315}
1316
1317func Test_apiRun_HEAD(t *testing.T) {
1318 ios, _, _, _ := iostreams.Test()

Callers

nothing calls this directly

Calls 4

TestFunction · 0.92
NewBlankConfigFunction · 0.92
apiRunFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected