use CanPrompt in commands

This commit is contained in:
vilmibm 2020-09-09 15:55:21 -05:00
parent fcc0e75a50
commit c0fc31f7d5
16 changed files with 119 additions and 67 deletions

View file

@ -49,19 +49,13 @@ func Test_NewCmdLogin(t *testing.T) {
name: "nontty, hostname",
stdinTTY: false,
cli: "--hostname claire.redfield",
wants: LoginOptions{
Hostname: "claire.redfield",
Token: "",
},
wantsErr: true,
},
{
name: "nontty",
stdinTTY: false,
cli: "",
wants: LoginOptions{
Hostname: "",
Token: "",
},
wantsErr: true,
},
{
name: "nontty, with-token, hostname",
@ -109,6 +103,7 @@ func Test_NewCmdLogin(t *testing.T) {
IOStreams: io,
}
io.SetStdoutTTY(true)
io.SetStdinTTY(tt.stdinTTY)
if tt.stdin != "" {
stdin.WriteString(tt.stdin)