MCPcopy Index your code
hub / github.com/cli/cli / Test_apiRun_DELETE

Function Test_apiRun_DELETE

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

Source from the content-addressed store, hash-verified

1205}
1206
1207func Test_apiRun_DELETE(t *testing.T) {
1208 ios, _, _, _ := iostreams.Test()
1209
1210 var gotRequest *http.Request
1211 err := apiRun(&ApiOptions{
1212 IO: ios,
1213 Config: func() (gh.Config, error) {
1214 return config.NewBlankConfig(), nil
1215 },
1216 HttpClient: func() (*http.Client, error) {
1217 var tr roundTripper = func(req *http.Request) (*http.Response, error) {
1218 gotRequest = req
1219 return &http.Response{StatusCode: 204, Request: req}, nil
1220 }
1221 return &http.Client{Transport: tr}, nil
1222 },
1223 MagicFields: []string(nil),
1224 RawFields: []string(nil),
1225 RequestMethod: "DELETE",
1226 RequestMethodPassed: true,
1227 })
1228 if err != nil {
1229 t.Fatalf("got error %v", err)
1230 }
1231
1232 if gotRequest.Body != nil {
1233 t.Errorf("expected nil request body, got %T", gotRequest.Body)
1234 }
1235}
1236
1237func Test_apiRun_HEAD(t *testing.T) {
1238 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