(httpClient *http.Client, cfg gh.Config, cli string)
| 116 | } |
| 117 | |
| 118 | func runCloneCommandWithConfig(httpClient *http.Client, cfg gh.Config, cli string) (*test.CmdOut, error) { |
| 119 | ios, stdin, stdout, stderr := iostreams.Test() |
| 120 | fac := &cmdutil.Factory{ |
| 121 | IOStreams: ios, |
| 122 | HttpClient: func() (*http.Client, error) { |
| 123 | return httpClient, nil |
| 124 | }, |
| 125 | Config: func() (gh.Config, error) { |
| 126 | return cfg, nil |
| 127 | }, |
| 128 | GitClient: &git.Client{ |
| 129 | GhPath: "some/path/gh", |
| 130 | GitPath: "some/path/git", |
| 131 | }, |
| 132 | } |
| 133 | |
| 134 | cmd := NewCmdClone(fac, nil) |
| 135 | |
| 136 | argv, err := shlex.Split(cli) |
| 137 | cmd.SetArgs(argv) |
| 138 | |
| 139 | cmd.SetIn(stdin) |
| 140 | cmd.SetOut(stderr) |
| 141 | cmd.SetErr(stderr) |
| 142 | |
| 143 | if err != nil { |
| 144 | panic(err) |
| 145 | } |
| 146 | |
| 147 | _, err = cmd.ExecuteC() |
| 148 | |
| 149 | if err != nil { |
| 150 | return nil, err |
| 151 | } |
| 152 | |
| 153 | return &test.CmdOut{OutBuf: stdout, ErrBuf: stderr}, nil |
| 154 | } |
| 155 | |
| 156 | func Test_RepoClone(t *testing.T) { |
| 157 | tests := []struct { |
no test coverage detected