mirror of
https://github.com/mjl-/mox.git
synced 2025-07-12 12:24:38 +03:00
fix the Status command on imapclient.Conn
it needs at least 1 attribute. also make types for those attributes, so its harder to get them wrong. nothing was using this function.
This commit is contained in:
@ -20,15 +20,50 @@ func TestStatus(t *testing.T) {
|
||||
tc.transactf("bad", "status inbox (unknown)") // Unknown attribute.
|
||||
|
||||
tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
|
||||
tc.xuntagged(imapclient.UntaggedStatus{Mailbox: "Inbox", Attrs: map[string]int64{"MESSAGES": 0, "UIDVALIDITY": 1, "UIDNEXT": 1, "UNSEEN": 0, "DELETED": 0, "SIZE": 0, "RECENT": 0, "APPENDLIMIT": 0}})
|
||||
tc.xuntagged(imapclient.UntaggedStatus{
|
||||
Mailbox: "Inbox",
|
||||
Attrs: map[imapclient.StatusAttr]int64{imapclient.StatusMessages: 0,
|
||||
imapclient.StatusUIDValidity: 1,
|
||||
imapclient.StatusUIDNext: 1,
|
||||
imapclient.StatusUnseen: 0,
|
||||
imapclient.StatusDeleted: 0,
|
||||
imapclient.StatusSize: 0,
|
||||
imapclient.StatusRecent: 0,
|
||||
imapclient.StatusAppendLimit: 0,
|
||||
},
|
||||
})
|
||||
|
||||
// Again, now with a message in the mailbox.
|
||||
tc.transactf("ok", "append inbox {4+}\r\ntest")
|
||||
tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
|
||||
tc.xuntagged(imapclient.UntaggedStatus{Mailbox: "Inbox", Attrs: map[string]int64{"MESSAGES": 1, "UIDVALIDITY": 1, "UIDNEXT": 2, "UNSEEN": 1, "DELETED": 0, "SIZE": 4, "RECENT": 0, "APPENDLIMIT": 0}})
|
||||
|
||||
tc.xuntagged(imapclient.UntaggedStatus{
|
||||
Mailbox: "Inbox",
|
||||
Attrs: map[imapclient.StatusAttr]int64{imapclient.StatusMessages: 1,
|
||||
imapclient.StatusUIDValidity: 1,
|
||||
imapclient.StatusUIDNext: 2,
|
||||
imapclient.StatusUnseen: 1,
|
||||
imapclient.StatusDeleted: 0,
|
||||
imapclient.StatusSize: 4,
|
||||
imapclient.StatusRecent: 0,
|
||||
imapclient.StatusAppendLimit: 0,
|
||||
},
|
||||
})
|
||||
|
||||
tc.client.Select("inbox")
|
||||
tc.client.StoreFlagsSet("1", true, `\Deleted`)
|
||||
tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
|
||||
tc.xuntagged(imapclient.UntaggedStatus{Mailbox: "Inbox", Attrs: map[string]int64{"MESSAGES": 1, "UIDVALIDITY": 1, "UIDNEXT": 2, "UNSEEN": 1, "DELETED": 1, "SIZE": 4, "RECENT": 0, "APPENDLIMIT": 0}})
|
||||
tc.xuntagged(imapclient.UntaggedStatus{
|
||||
Mailbox: "Inbox",
|
||||
Attrs: map[imapclient.StatusAttr]int64{imapclient.StatusMessages: 1,
|
||||
imapclient.StatusUIDValidity: 1,
|
||||
imapclient.StatusUIDNext: 2,
|
||||
imapclient.StatusUnseen: 1,
|
||||
imapclient.StatusDeleted: 1,
|
||||
imapclient.StatusSize: 4,
|
||||
imapclient.StatusRecent: 0,
|
||||
imapclient.StatusAppendLimit: 0,
|
||||
},
|
||||
})
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user