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

Function Test_apiRun_HEAD

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

Source from the content-addressed store, hash-verified

1417}
1418
1419func Test_apiRun_HEAD(t *testing.T) {
1420 ios, _, _, _ := iostreams.Test()
1421
1422 err := apiRun(&ApiOptions{
1423 IO: ios,
1424 Config: func() (gh.Config, error) {
1425 return config.NewMockConfig(), nil
1426 },
1427 HttpClient: func(rootapi.HTTPClientOptions) (*http.Client, error) {
1428 var tr roundTripper = func(req *http.Request) (*http.Response, error) {
1429 return &http.Response{
1430 StatusCode: 422,
1431 Request: req,
1432 Header: map[string][]string{
1433 "Content-Type": {"application/json"},
1434 }}, nil
1435 }
1436 return &http.Client{Transport: tr}, nil
1437 },
1438 MagicFields: []string(nil),
1439 RawFields: []string(nil),
1440 RequestMethod: "HEAD",
1441 RequestMethodPassed: true,
1442 })
1443 if err != cmdutil.SilentError {
1444 t.Fatalf("got error %v", err)
1445 }
1446}
1447
1448func Test_apiRun_inputFile(t *testing.T) {
1449 tests := []struct {

Callers

nothing calls this directly

Calls 3

TestFunction · 0.92
NewMockConfigFunction · 0.92
apiRunFunction · 0.85

Tested by

no test coverage detected