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

Function Test_apiRun_DELETE

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

Source from the content-addressed store, hash-verified

1317}
1318
1319func Test_apiRun_DELETE(t *testing.T) {
1320 ios, _, _, _ := iostreams.Test()
1321
1322 var gotRequest *http.Request
1323 err := apiRun(&ApiOptions{
1324 IO: ios,
1325 Config: func() (gh.Config, error) {
1326 return config.NewMockConfig(), nil
1327 },
1328 HttpClient: func(rootapi.HTTPClientOptions) (*http.Client, error) {
1329 var tr roundTripper = func(req *http.Request) (*http.Response, error) {
1330 gotRequest = req
1331 return &http.Response{StatusCode: 204, Request: req}, nil
1332 }
1333 return &http.Client{Transport: tr}, nil
1334 },
1335 MagicFields: []string(nil),
1336 RawFields: []string(nil),
1337 RequestMethod: "DELETE",
1338 RequestMethodPassed: true,
1339 })
1340 if err != nil {
1341 t.Fatalf("got error %v", err)
1342 }
1343
1344 if gotRequest.Body != nil {
1345 t.Errorf("expected nil request body, got %T", gotRequest.Body)
1346 }
1347}
1348
1349func Test_apiRun_HEAD(t *testing.T) {
1350 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