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