(rt http.RoundTripper, pm *prompter.MockPrompter, isTTY bool, cli string)
| 26 | } |
| 27 | |
| 28 | func runCommand(rt http.RoundTripper, pm *prompter.MockPrompter, isTTY bool, cli string) (*test.CmdOut, error) { |
| 29 | ios, _, stdout, stderr := iostreams.Test() |
| 30 | ios.SetStdoutTTY(isTTY) |
| 31 | ios.SetStdinTTY(isTTY) |
| 32 | ios.SetStderrTTY(isTTY) |
| 33 | |
| 34 | factory := &cmdutil.Factory{ |
| 35 | IOStreams: ios, |
| 36 | Prompter: pm, |
| 37 | HttpClient: func() (*http.Client, error) { |
| 38 | return &http.Client{Transport: rt}, nil |
| 39 | }, |
| 40 | Config: func() (gh.Config, error) { |
| 41 | return config.NewBlankConfig(), nil |
| 42 | }, |
| 43 | BaseRepo: func() (ghrepo.Interface, error) { |
| 44 | return ghrepo.New("OWNER", "REPO"), nil |
| 45 | }, |
| 46 | } |
| 47 | |
| 48 | cmd := NewCmdDelete(factory, nil) |
| 49 | |
| 50 | argv, err := shlex.Split(cli) |
| 51 | if err != nil { |
| 52 | return nil, err |
| 53 | } |
| 54 | cmd.SetArgs(argv) |
| 55 | |
| 56 | cmd.SetIn(&bytes.Buffer{}) |
| 57 | cmd.SetOut(io.Discard) |
| 58 | cmd.SetErr(io.Discard) |
| 59 | |
| 60 | _, err = cmd.ExecuteC() |
| 61 | return &test.CmdOut{ |
| 62 | OutBuf: stdout, |
| 63 | ErrBuf: stderr, |
| 64 | }, err |
| 65 | } |
| 66 | |
| 67 | func TestIssueDelete(t *testing.T) { |
| 68 | httpRegistry := &httpmock.Registry{} |
no test coverage detected