(rt http.RoundTripper, isTTY bool, cli string)
| 63 | } |
| 64 | |
| 65 | func runCommand(rt http.RoundTripper, isTTY bool, cli string) (*test.CmdOut, error) { |
| 66 | ios, _, stdout, stderr := iostreams.Test() |
| 67 | ios.SetStdoutTTY(isTTY) |
| 68 | ios.SetStdinTTY(isTTY) |
| 69 | ios.SetStderrTTY(isTTY) |
| 70 | |
| 71 | factory := &cmdutil.Factory{ |
| 72 | IOStreams: ios, |
| 73 | HttpClient: func() (*http.Client, error) { |
| 74 | return &http.Client{Transport: rt}, nil |
| 75 | }, |
| 76 | Config: func() (gh.Config, error) { |
| 77 | return config.NewBlankConfig(), nil |
| 78 | }, |
| 79 | BaseRepo: func() (ghrepo.Interface, error) { |
| 80 | return ghrepo.New("OWNER", "REPO"), nil |
| 81 | }, |
| 82 | } |
| 83 | |
| 84 | cmd := NewCmdView(factory, nil) |
| 85 | |
| 86 | argv, err := shlex.Split(cli) |
| 87 | if err != nil { |
| 88 | return nil, err |
| 89 | } |
| 90 | cmd.SetArgs(argv) |
| 91 | |
| 92 | cmd.SetIn(&bytes.Buffer{}) |
| 93 | cmd.SetOut(io.Discard) |
| 94 | cmd.SetErr(io.Discard) |
| 95 | |
| 96 | _, err = cmd.ExecuteC() |
| 97 | return &test.CmdOut{ |
| 98 | OutBuf: stdout, |
| 99 | ErrBuf: stderr, |
| 100 | }, err |
| 101 | } |
| 102 | |
| 103 | func TestIssueView_web(t *testing.T) { |
| 104 | ios, _, stdout, stderr := iostreams.Test() |
no test coverage detected