mail: quota support
This commit is contained in:
@@ -114,16 +114,16 @@ describe('Mail', function () {
|
||||
|
||||
describe('mailboxes', function () {
|
||||
it('add user mailbox succeeds', async function () {
|
||||
await mail.addMailbox('girish', domain.domain, { ownerId: 'uid-0', ownerType: mail.OWNERTYPE_USER, active: true }, auditSource);
|
||||
await mail.addMailbox('girish', domain.domain, { ownerId: 'uid-0', ownerType: mail.OWNERTYPE_USER, active: true, storageQuota: 0, messagesQuota: 0 }, auditSource);
|
||||
});
|
||||
|
||||
it('cannot add dup entry', async function () {
|
||||
const [error] = await safe(mail.addMailbox('girish', domain.domain, { ownerId: 'uid-1', ownerType: mail.OWNERTYPE_GROUP, active: true }, auditSource));
|
||||
const [error] = await safe(mail.addMailbox('girish', domain.domain, { ownerId: 'uid-1', ownerType: mail.OWNERTYPE_GROUP, active: true, storageQuota: 0, messagesQuota: 0 }, auditSource));
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
});
|
||||
|
||||
it('add app mailbox succeeds', async function () {
|
||||
await mail.addMailbox('support', domain.domain, { ownerId: 'osticket', ownerType: 'user', active: true}, auditSource);
|
||||
await mail.addMailbox('support', domain.domain, { ownerId: 'osticket', ownerType: 'user', active: true, storageQuota: 10, messagesQuota: 20}, auditSource);
|
||||
});
|
||||
|
||||
it('get succeeds', async function () {
|
||||
@@ -132,6 +132,8 @@ describe('Mail', function () {
|
||||
expect(mailbox.ownerId).to.equal('osticket');
|
||||
expect(mailbox.domain).to.equal(domain.domain);
|
||||
expect(mailbox.creationTime).to.be.a(Date);
|
||||
expect(mailbox.storageQuota).to.be(10);
|
||||
expect(mailbox.messagesQuota).to.be(20);
|
||||
});
|
||||
|
||||
it('get non-existent mailbox', async function () {
|
||||
@@ -139,6 +141,14 @@ describe('Mail', function () {
|
||||
expect(mailbox).to.be(null);
|
||||
});
|
||||
|
||||
it('update app mailbox succeeds', async function () {
|
||||
await mail.updateMailbox('support', domain.domain, { ownerId: 'osticket', ownerType: 'user', active: true, storageQuota: 20, messagesQuota: 30}, auditSource);
|
||||
|
||||
const mailbox = await mail.getMailbox('support', domain.domain);
|
||||
expect(mailbox.storageQuota).to.be(20);
|
||||
expect(mailbox.messagesQuota).to.be(30);
|
||||
});
|
||||
|
||||
it('list mailboxes succeeds', async function () {
|
||||
const mailboxes = await mail.listMailboxes(domain.domain, null /* search */, 1, 10);
|
||||
expect(mailboxes.length).to.be(2);
|
||||
|
||||
Reference in New Issue
Block a user