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

Function Test_apiRun_HEAD

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

Source from the content-addressed store, hash-verified

1347}
1348
1349func Test_apiRun_HEAD(t *testing.T) {
1350 ios, _, _, _ := iostreams.Test()
1351
1352 err := apiRun(&ApiOptions{
1353 IO: ios,
1354 Config: func() (gh.Config, error) {
1355 return config.NewMockConfig(), nil
1356 },
1357 HttpClient: func(rootapi.HTTPClientOptions) (*http.Client, error) {
1358 var tr roundTripper = func(req *http.Request) (*http.Response, error) {
1359 return &http.Response{
1360 StatusCode: 422,
1361 Request: req,
1362 Header: map[string][]string{
1363 "Content-Type": {"application/json"},
1364 }}, nil
1365 }
1366 return &http.Client{Transport: tr}, nil
1367 },
1368 MagicFields: []string(nil),
1369 RawFields: []string(nil),
1370 RequestMethod: "HEAD",
1371 RequestMethodPassed: true,
1372 })
1373 if err != cmdutil.SilentError {
1374 t.Fatalf("got error %v", err)
1375 }
1376}
1377
1378func Test_apiRun_inputFile(t *testing.T) {
1379 tests := []struct {

Callers

nothing calls this directly

Calls 3

TestFunction · 0.92
NewMockConfigFunction · 0.92
apiRunFunction · 0.85

Tested by

no test coverage detected