mirror of
https://github.com/profullstack/agentbbs.git
synced 2026-08-13 22:37:28 +00:00
fix(mailbox): validate bot list limits (#77)
This commit is contained in:
parent
6a086eb7cc
commit
3a4d7ed8d8
2 changed files with 25 additions and 1 deletions
|
|
@ -1,8 +1,10 @@
|
|||
package mailbox
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -210,3 +212,21 @@ func TestFlagAndDelete(t *testing.T) {
|
|||
t.Fatal("uid 1 should be deleted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunBotListRejectsInvalidLimit(t *testing.T) {
|
||||
c := paidClient(seeded())
|
||||
|
||||
for _, args := range [][]string{
|
||||
{"list", Inbox, "nope"},
|
||||
{"list", Inbox, "-5"},
|
||||
} {
|
||||
var out bytes.Buffer
|
||||
err := RunBot(context.Background(), c, args, strings.NewReader(""), &out)
|
||||
if err == nil {
|
||||
t.Fatalf("RunBot(%v) expected error", args)
|
||||
}
|
||||
if !strings.Contains(out.String(), "invalid list limit") {
|
||||
t.Fatalf("RunBot(%v) output = %q, want invalid limit error", args, out.String())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue