Skip to content

Commit a6c7a88

Browse files
committed
use dummy io streams for cobra
1 parent f84365c commit a6c7a88

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/cmd/repo/create/create_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package create
22

33
import (
4+
"bytes"
45
"encoding/json"
56
"io/ioutil"
67
"net/http"
@@ -19,7 +20,7 @@ import (
1920
)
2021

2122
func runCommand(httpClient *http.Client, cli string) (*test.CmdOut, error) {
22-
io, stdin, stdout, stderr := iostreams.Test()
23+
io, _, stdout, stderr := iostreams.Test()
2324
fac := &cmdutil.Factory{
2425
IOStreams: io,
2526
HttpClient: func() (*http.Client, error) {
@@ -42,9 +43,9 @@ func runCommand(httpClient *http.Client, cli string) (*test.CmdOut, error) {
4243
argv, err := shlex.Split(cli)
4344
cmd.SetArgs(argv)
4445

45-
cmd.SetIn(stdin)
46-
cmd.SetOut(stdout)
47-
cmd.SetErr(stderr)
46+
cmd.SetIn(&bytes.Buffer{})
47+
cmd.SetOut(&bytes.Buffer{})
48+
cmd.SetErr(&bytes.Buffer{})
4849

4950
if err != nil {
5051
panic(err)

0 commit comments

Comments
 (0)