mail: quota support

This commit is contained in:
Girish Ramakrishnan
2022-08-17 23:18:38 +02:00
parent 1c18c16e38
commit b23189b45c
7 changed files with 70 additions and 17 deletions

View File

@@ -422,7 +422,7 @@ describe('Mail API', function () {
it('add succeeds', async function () {
const response = await superagent.post(`${serverUrl}/api/v1/mail/${dashboardDomain}/mailboxes`)
.send({ name: MAILBOX_NAME, ownerId: owner.id, ownerType: 'user', active: true })
.send({ name: MAILBOX_NAME, ownerId: owner.id, ownerType: 'user', active: true, storageQuota: 10, messagesQuota: 20 })
.query({ access_token: owner.token });
expect(response.statusCode).to.equal(201);
@@ -430,7 +430,7 @@ describe('Mail API', function () {
it('cannot add again', async function () {
const response = await superagent.post(`${serverUrl}/api/v1/mail/${dashboardDomain}/mailboxes`)
.send({ name: MAILBOX_NAME, ownerId: owner.id, ownerType: 'user', active: true })
.send({ name: MAILBOX_NAME, ownerId: owner.id, ownerType: 'user', active: true, storageQuota: 10, messagesQuota: 20 })
.query({ access_token: owner.token })
.ok(() => true);
@@ -457,6 +457,8 @@ describe('Mail API', function () {
expect(response.body.mailbox.aliasName).to.equal(null);
expect(response.body.mailbox.aliasDomain).to.equal(null);
expect(response.body.mailbox.domain).to.equal(dashboardDomain);
expect(response.body.mailbox.storageQuota).to.equal(10);
expect(response.body.mailbox.messagesQuota).to.equal(20);
});
it('listing succeeds', async function () {
@@ -471,6 +473,8 @@ describe('Mail API', function () {
expect(response.body.mailboxes[0].ownerType).to.equal('user');
expect(response.body.mailboxes[0].aliases).to.eql([]);
expect(response.body.mailboxes[0].domain).to.equal(dashboardDomain);
expect(response.body.mailboxes[0].storageQuota).to.equal(10);
expect(response.body.mailboxes[0].messagesQuota).to.equal(20);
});
it('disable fails even if not exist', async function () {
@@ -505,7 +509,7 @@ describe('Mail API', function () {
it('add the mailbox', async function () {
const response = await superagent.post(`${serverUrl}/api/v1/mail/${dashboardDomain}/mailboxes`)
.send({ name: MAILBOX_NAME, ownerId: owner.id, ownerType: 'user', active: true })
.send({ name: MAILBOX_NAME, ownerId: owner.id, ownerType: 'user', active: true, storageQuota: 10, messagesQuota: 20 })
.query({ access_token: owner.token });
expect(response.statusCode).to.equal(201);