rework mail domain stats
We can now show list count, alias count as well in the mail domains UI
This commit is contained in:
@@ -360,7 +360,7 @@ describe('Ldap Server', function () {
|
||||
const LIST_NAME = 'devs', LIST = `devs@${domain.domain}`;
|
||||
|
||||
before(async function () {
|
||||
await mail.addList(LIST_NAME, domain.domain, { members: [ mailbox , 'outsider@external.com' ], membersOnly: false, active: true }, auditSource);
|
||||
await mail.addMailingList(LIST_NAME, domain.domain, { members: [ mailbox , 'outsider@external.com' ], membersOnly: false, active: true }, auditSource);
|
||||
});
|
||||
|
||||
it('get specific list', async function () {
|
||||
@@ -376,7 +376,7 @@ describe('Ldap Server', function () {
|
||||
});
|
||||
|
||||
it('inactive list', async function () {
|
||||
await mail.updateList(LIST_NAME, domain.domain, { members: [ mailbox , 'outsider@external.com' ], membersOnly: false, active: false }, auditSource);
|
||||
await mail.updateMailingList(LIST_NAME, domain.domain, { members: [ mailbox , 'outsider@external.com' ], membersOnly: false, active: false }, auditSource);
|
||||
const [error] = await safe(ldapSearch('cn=devs@example.com,ou=mailinglists,dc=cloudron', 'objectclass=mailGroup'));
|
||||
expect(error).to.be.a(ldap.NoSuchObjectError);
|
||||
});
|
||||
|
||||
+11
-11
@@ -156,15 +156,15 @@ describe('Mail', function () {
|
||||
expect(mailbox.enablePop3).to.be(true);
|
||||
});
|
||||
|
||||
it('list mailboxes succeeds', async function () {
|
||||
const mailboxes = await mail.listMailboxes(domain.domain, null /* search */, 1, 10);
|
||||
it('list mailboxes by domain succeeds', async function () {
|
||||
const mailboxes = await mail.listMailboxesByDomain(domain.domain, 1, 10);
|
||||
expect(mailboxes.length).to.be(2);
|
||||
expect(mailboxes[0].name).to.be('girish');
|
||||
expect(mailboxes[1].name).to.be('support');
|
||||
});
|
||||
|
||||
it('list all mailboxes succeeds', async function () {
|
||||
const mailboxes = await mail.listAllMailboxes(1, 10);
|
||||
const mailboxes = await mail.listMailboxes(1, 10);
|
||||
expect(mailboxes.length).to.be(2);
|
||||
expect(mailboxes[0].name).to.be('girish');
|
||||
expect(mailboxes[0].domain).to.be(domain.domain);
|
||||
@@ -173,8 +173,8 @@ describe('Mail', function () {
|
||||
});
|
||||
|
||||
it('mailbox count succeeds', async function () {
|
||||
const count = await mail.getMailboxCount(domain.domain);
|
||||
expect(count).to.be(2);
|
||||
const stats = await mail.getStats(domain.domain);
|
||||
expect(stats.mailboxCount).to.be(2);
|
||||
});
|
||||
|
||||
it('can set alias', async function () {
|
||||
@@ -211,27 +211,27 @@ describe('Mail', function () {
|
||||
});
|
||||
|
||||
it('add list succeeds', async function () {
|
||||
await mail.addList('people', domain.domain, { members: [ 'test@cloudron.io' ], membersOnly: false, active: true }, auditSource);
|
||||
await mail.addMailingList('people', domain.domain, { members: [ 'test@cloudron.io' ], membersOnly: false, active: true }, auditSource);
|
||||
});
|
||||
|
||||
it('cannot add dup list', async function () {
|
||||
const [error] = await safe(mail.addList('people', domain.domain, { members: [ 'admin@cloudron.io' ], membersOnly: false, active: true }, auditSource));
|
||||
const [error] = await safe(mail.addMailingList('people', domain.domain, { members: [ 'admin@cloudron.io' ], membersOnly: false, active: true }, auditSource));
|
||||
expect(error.reason).to.be(BoxError.ALREADY_EXISTS);
|
||||
});
|
||||
|
||||
it('cannot get non-existing list', async function () {
|
||||
const result = await mail.getList('random', domain.domain);
|
||||
const result = await mail.getMailingList('random', domain.domain);
|
||||
expect(result).to.be(null);
|
||||
});
|
||||
|
||||
it('del list succeeds', async function () {
|
||||
await mail.delList('people', domain.domain, auditSource);
|
||||
const result = await mail.getList('people', domain.domain);
|
||||
await mail.delMailingList('people', domain.domain, auditSource);
|
||||
const result = await mail.getMailingList('people', domain.domain);
|
||||
expect(result).to.be(null);
|
||||
});
|
||||
|
||||
it('del non-existent list fails', async function () {
|
||||
const [error] = await safe(mail.delList('people', domain.domain, auditSource));
|
||||
const [error] = await safe(mail.delMailingList('people', domain.domain, auditSource));
|
||||
expect(error.reason).to.be(BoxError.NOT_FOUND);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user