prompts disabled test for auth refresh
the behavior for nontty vs. prompts disabled is pretty different so i opted for a new test, here
This commit is contained in:
parent
c0fc31f7d5
commit
4d3e26e927
1 changed files with 23 additions and 5 deletions
|
|
@ -18,11 +18,12 @@ import (
|
|||
|
||||
func Test_NewCmdRefresh(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
cli string
|
||||
wants RefreshOptions
|
||||
wantsErr bool
|
||||
tty bool
|
||||
name string
|
||||
cli string
|
||||
wants RefreshOptions
|
||||
wantsErr bool
|
||||
tty bool
|
||||
neverPrompt bool
|
||||
}{
|
||||
{
|
||||
name: "tty no arguments",
|
||||
|
|
@ -48,6 +49,22 @@ func Test_NewCmdRefresh(t *testing.T) {
|
|||
Hostname: "aline.cedrac",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "prompts disabled, no args",
|
||||
tty: true,
|
||||
cli: "",
|
||||
neverPrompt: true,
|
||||
wantsErr: true,
|
||||
},
|
||||
{
|
||||
name: "prompts disabled, hostname",
|
||||
tty: true,
|
||||
cli: "-h aline.cedrac",
|
||||
neverPrompt: true,
|
||||
wants: RefreshOptions{
|
||||
Hostname: "aline.cedrac",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "tty one scope",
|
||||
tty: true,
|
||||
|
|
@ -74,6 +91,7 @@ func Test_NewCmdRefresh(t *testing.T) {
|
|||
}
|
||||
io.SetStdinTTY(tt.tty)
|
||||
io.SetStdoutTTY(tt.tty)
|
||||
io.SetNeverPrompt(tt.neverPrompt)
|
||||
|
||||
argv, err := shlex.Split(tt.cli)
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue