feat(cli): positional account grammar, account show, TTY remove confirm; drop whitelist flags
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAccountShow(t *testing.T) {
|
||||
adminEnv(t)
|
||||
run(t, "account", "add", "shown", "--mode", "RW",
|
||||
"--imap-host", "imap.x.com", "--imap-port", "993",
|
||||
"--smtp-host", "smtp.x.com", "--smtp-port", "465",
|
||||
"--username", "u@x.com", "--password", "secret", "--from", "me@x.com")
|
||||
code, out, _ := run(t, "account", "show", "shown")
|
||||
if code != 0 {
|
||||
t.Fatalf("show exit=%d", code)
|
||||
}
|
||||
for _, want := range []string{"shown", "RW", "imap.x.com:993", "smtp.x.com:465", "u@x.com", "me@x.com"} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Fatalf("show missing %q:\n%s", want, out)
|
||||
}
|
||||
}
|
||||
if strings.Contains(out, "secret") {
|
||||
t.Fatalf("show must never print the password:\n%s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAccountShowMissingName(t *testing.T) {
|
||||
adminEnv(t)
|
||||
if code, _, _ := run(t, "account", "show"); code != 2 {
|
||||
t.Fatal("show without a name must be a usage error")
|
||||
}
|
||||
if code, _, _ := run(t, "account", "show", "nope"); code == 0 {
|
||||
t.Fatal("show of a missing account must be non-zero")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user