Files
zeekayandHanzo Dev 15909c7b79 Rename Go module path to github.com/hanzoai/mail
Fork of github.com/mjl-/mox at 5656ca6d1b
(upstream v0.0.15 plus 55 commits).

Rename the module path in go.mod and the import paths in 268 Go files. Also
update the five scripts that "go install" the module (genwebsite.sh,
docker-release.sh, apidiff.sh, test-upgrade.sh, Dockerfile.release), which
would otherwise build upstream rather than this fork.

Add NOTICE recording the upstream project, author, license, and fork point,
and stating which license covers which files: MIT for the mox source and our
changes, MPL-2.0 for publicsuffix/public_suffix_list.txt alone, and the
vendored dependencies' own licenses under licenses/. Embed NOTICE so
"mail licenses" prints the lineage from the running binary. LICENSE.MIT,
LICENSE.MPLv2.0 and the licenses/ tree are preserved verbatim; no code is
relicensed.

The mox command name, config keys, data directory layout and website content
are unchanged. LLM.md records the fork point, the rename, what was left alone,
and the steps to stand the server up.

Co-authored-by: Hanzo Dev <[email protected]>
2026-07-27 23:16:19 -07:00

80 lines
2.4 KiB
Go

package imapserver
import (
"testing"
"github.com/hanzoai/mail/imapclient"
)
func TestStatus(t *testing.T) {
testStatus(t, false)
}
func TestStatusUIDOnly(t *testing.T) {
testStatus(t, true)
}
func testStatus(t *testing.T, uidonly bool) {
defer mockUIDValidity()()
tc := start(t, uidonly)
defer tc.close()
tc.login("[email protected]", password0)
tc.transactf("bad", "status") // Missing param.
tc.transactf("bad", "status inbox") // Missing param.
tc.transactf("bad", "status inbox ()") // At least one attribute required.
tc.transactf("bad", "status inbox (uidvalidity) ") // Leftover data.
tc.transactf("bad", "status inbox (unknown)") // Unknown attribute.
tc.transactf("no", "status expungebox (messages)") // No longer exists.
tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
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[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.UIDStoreFlagsSet("1", true, `\Deleted`)
tc.transactf("ok", "status inbox (messages uidnext uidvalidity unseen deleted size recent appendlimit)")
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,
},
})
}