Skip to content

Commit 3a492b8

Browse files
committed
Merge branch 'disable-prompts' of github.com:cli/cli into disable-prompts
2 parents 2e95e27 + 4d3e26e commit 3a492b8

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

pkg/cmd/auth/refresh/refresh_test.go

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ import (
1818

1919
func Test_NewCmdRefresh(t *testing.T) {
2020
tests := []struct {
21-
name string
22-
cli string
23-
wants RefreshOptions
24-
wantsErr bool
25-
tty bool
21+
name string
22+
cli string
23+
wants RefreshOptions
24+
wantsErr bool
25+
tty bool
26+
neverPrompt bool
2627
}{
2728
{
2829
name: "tty no arguments",
@@ -48,6 +49,22 @@ func Test_NewCmdRefresh(t *testing.T) {
4849
Hostname: "aline.cedrac",
4950
},
5051
},
52+
{
53+
name: "prompts disabled, no args",
54+
tty: true,
55+
cli: "",
56+
neverPrompt: true,
57+
wantsErr: true,
58+
},
59+
{
60+
name: "prompts disabled, hostname",
61+
tty: true,
62+
cli: "-h aline.cedrac",
63+
neverPrompt: true,
64+
wants: RefreshOptions{
65+
Hostname: "aline.cedrac",
66+
},
67+
},
5168
{
5269
name: "tty one scope",
5370
tty: true,
@@ -74,6 +91,7 @@ func Test_NewCmdRefresh(t *testing.T) {
7491
}
7592
io.SetStdinTTY(tt.tty)
7693
io.SetStdoutTTY(tt.tty)
94+
io.SetNeverPrompt(tt.neverPrompt)
7795

7896
argv, err := shlex.Split(tt.cli)
7997
assert.NoError(t, err)

0 commit comments

Comments
 (0)