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

Function Test_apiRun_HEAD

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

TestFunction · 0.92
NewMockConfigFunction · 0.92
apiRunFunction · 0.85

Tested by

no test coverage detected