diff --git a/pkg/cmd/auth/refresh/refresh_test.go b/pkg/cmd/auth/refresh/refresh_test.go index cba3c107a..46db2af52 100644 --- a/pkg/cmd/auth/refresh/refresh_test.go +++ b/pkg/cmd/auth/refresh/refresh_test.go @@ -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)