fixup! add support for the imap quota extension (RFC 2087)

This commit is contained in:
Edward Rudd 2022-10-18 22:34:10 -04:00
parent f57dfd4a0c
commit 0a9297f0fc

View file

@ -725,15 +725,35 @@ fn quota() {
if is_greenmail { if is_greenmail {
let mut c = session(to); let mut c = session(to);
// Set a quota
c.set_quota("INBOX", &[QuotaResourceLimit::new("STORAGE", 1000)])
.unwrap();
// Check it
let quota_root = c.get_quota_root("INBOX").unwrap(); let quota_root = c.get_quota_root("INBOX").unwrap();
assert_eq!(quota_root.mailbox_name(), "INBOX"); assert_eq!(quota_root.mailbox_name(), "INBOX");
let root_names = quota_root.quota_root_names().collect::<Vec<&str>>(); let root_names = quota_root.quota_root_names().collect::<Vec<&str>>();
// not sure why, but greenmail returns no quota root names
assert_eq!(root_names, Vec::<&str>::new()); assert_eq!(root_names, Vec::<&str>::new());
// TODO build tests for greenmail
assert_eq!(quota_root.quotas().len(), 1);
let quota = quota_root.quotas().first().unwrap();
assert_eq!(quota.root_name, "INBOX");
assert_quota_resource(
&quota.resources[0],
QuotaResourceName::Storage,
1000,
Some(0),
);
// TODO no reliable way to delete a quota from greenmail other than resetting the whole system
// Deleting a mailbox or user in greenmail does not remove the quota
} else { } else {
// because we are cyrus we can "test" the admin account for checking the GET/SET commands // because we are cyrus we can "test" the admin account for checking the GET/SET commands
// the clean: false is because the cyrus admin user has no INBOX.
let mut admin = session_with_options("cyrus", false); let mut admin = session_with_options("cyrus", false);
// purge mailbox from previous run // purge mailbox from previous run