6 "github.com/mjl-/mox/imapclient"
9func TestStatus(t *testing.T) {
10 defer mockUIDValidity()()
14 tc.client.Login("mjl@mox.example", password0)
16 tc.transactf("bad", "status") // Missing param.
17 tc.transactf("bad", "status inbox") // Missing param.
18 tc.transactf("bad", "status inbox ()") // At least one attribute required.
19 tc.transactf("bad", "status inbox (uidvalidity) ") // Leftover data.
20 tc.transactf("bad", "status inbox (unknown)") // Unknown attribute.
22 tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
23 tc.xuntagged(imapclient.UntaggedStatus{
25 Attrs: map[imapclient.StatusAttr]int64{imapclient.StatusMessages: 0,
26 imapclient.StatusUIDValidity: 1,
27 imapclient.StatusUIDNext: 1,
28 imapclient.StatusUnseen: 0,
29 imapclient.StatusDeleted: 0,
30 imapclient.StatusSize: 0,
31 imapclient.StatusRecent: 0,
32 imapclient.StatusAppendLimit: 0,
36 // Again, now with a message in the mailbox.
37 tc.transactf("ok", "append inbox {4+}\r\ntest")
38 tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
40 tc.xuntagged(imapclient.UntaggedStatus{
42 Attrs: map[imapclient.StatusAttr]int64{imapclient.StatusMessages: 1,
43 imapclient.StatusUIDValidity: 1,
44 imapclient.StatusUIDNext: 2,
45 imapclient.StatusUnseen: 1,
46 imapclient.StatusDeleted: 0,
47 imapclient.StatusSize: 4,
48 imapclient.StatusRecent: 0,
49 imapclient.StatusAppendLimit: 0,
53 tc.client.Select("inbox")
54 tc.client.StoreFlagsSet("1", true, `\Deleted`)
55 tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
56 tc.xuntagged(imapclient.UntaggedStatus{
58 Attrs: map[imapclient.StatusAttr]int64{imapclient.StatusMessages: 1,
59 imapclient.StatusUIDValidity: 1,
60 imapclient.StatusUIDNext: 2,
61 imapclient.StatusUnseen: 1,
62 imapclient.StatusDeleted: 1,
63 imapclient.StatusSize: 4,
64 imapclient.StatusRecent: 0,
65 imapclient.StatusAppendLimit: 0,