2023-01-30 16:27:06 +03:00
|
|
|
package imapserver
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/mjl-/mox/imapclient"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestUnselect(t *testing.T) {
|
|
|
|
tc := start(t)
|
|
|
|
defer tc.close()
|
|
|
|
|
2024-03-09 01:29:15 +03:00
|
|
|
tc.client.Login("mjl@mox.example", password0)
|
2023-01-30 16:27:06 +03:00
|
|
|
tc.client.Select("inbox")
|
|
|
|
|
|
|
|
tc.transactf("bad", "unselect bogus") // Leftover data.
|
|
|
|
tc.transactf("ok", "unselect")
|
|
|
|
tc.transactf("no", "fetch 1 all") // Invalid when not selected.
|
|
|
|
|
|
|
|
tc.client.Select("inbox")
|
|
|
|
tc.client.Append("inbox", nil, nil, []byte(exampleMsg))
|
|
|
|
tc.client.StoreFlagsAdd("1", true, `\Deleted`)
|
|
|
|
tc.transactf("ok", "unselect")
|
|
|
|
tc.transactf("ok", "status inbox (messages)")
|
|
|
|
tc.xuntagged(imapclient.UntaggedStatus{Mailbox: "Inbox", Attrs: map[string]int64{"MESSAGES": 1}}) // Message not removed.
|
|
|
|
}
|