mirror of
https://github.com/larksuite/cli.git
synced 2026-07-03 22:24:31 +08:00
Compare commits
1 Commits
codex/opti
...
fix/shortc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b88039eeca |
@@ -127,8 +127,8 @@ func (f *Factory) CheckIdentity(as core.Identity, supported []string) error {
|
||||
list := strings.Join(supported, ", ")
|
||||
if f.IdentityAutoDetected {
|
||||
return output.ErrValidation(
|
||||
"resolved identity %q (via auto-detect or default-as) is not supported, this command only supports: %s\nhint: use --as %s",
|
||||
as, list, supported[0])
|
||||
"this command requires %s identity, but no user login was found (auto-detected as %s)\nhint: run `lark-cli auth login` first, then retry",
|
||||
list, as)
|
||||
}
|
||||
return fmt.Errorf("--as %s is not supported, this command only supports: %s", as, list)
|
||||
}
|
||||
|
||||
@@ -174,15 +174,15 @@ func TestCheckIdentity_Unsupported_AutoDetected(t *testing.T) {
|
||||
f, _, _, _ := TestFactory(t, &core.CliConfig{AppID: "a", AppSecret: "s"})
|
||||
f.IdentityAutoDetected = true
|
||||
|
||||
err := f.CheckIdentity(core.AsUser, []string{"bot"})
|
||||
err := f.CheckIdentity(core.AsBot, []string{"user"})
|
||||
if err == nil {
|
||||
t.Fatal("expected error")
|
||||
}
|
||||
if !strings.Contains(err.Error(), "resolved identity") {
|
||||
t.Errorf("expected 'resolved identity' in error, got: %v", err)
|
||||
if !strings.Contains(err.Error(), "requires user identity") {
|
||||
t.Errorf("expected 'requires user identity' in error, got: %v", err)
|
||||
}
|
||||
if !strings.Contains(err.Error(), "hint: use --as bot") {
|
||||
t.Errorf("expected hint in error, got: %v", err)
|
||||
if !strings.Contains(err.Error(), "auth login") {
|
||||
t.Errorf("expected 'auth login' hint in error, got: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user