Add test to check mailbox gets add/removed with group API
This commit is contained in:
@@ -9,10 +9,12 @@
|
||||
var async = require('async'),
|
||||
constants = require('../constants.js'),
|
||||
database = require('../database.js'),
|
||||
DatabaseError = require('../databaseerror.js'),
|
||||
expect = require('expect.js'),
|
||||
groups = require('../groups.js'),
|
||||
GroupError = groups.GroupError,
|
||||
hat = require('hat'),
|
||||
mailboxdb = require('../mailboxdb.js'),
|
||||
userdb = require('../userdb.js');
|
||||
|
||||
var GROUP0_NAME = 'administrators',
|
||||
@@ -87,6 +89,14 @@ describe('Groups', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('did create mailbox', function (done) {
|
||||
mailboxdb.getGroup(GROUP0_NAME.toLowerCase(), function (error, mailbox) {
|
||||
expect(error).to.be(null);
|
||||
expect(mailbox.ownerType).to.be(mailboxdb.TYPE_GROUP);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('cannot add existing group', function (done) {
|
||||
groups.create(GROUP0_NAME, function (error) {
|
||||
expect(error.reason).to.be(GroupError.ALREADY_EXISTS);
|
||||
@@ -122,6 +132,13 @@ describe('Groups', function () {
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('did delete mailbox', function (done) {
|
||||
mailboxdb.getGroup(GROUP0_NAME.toLowerCase(), function (error) {
|
||||
expect(error.reason).to.be(DatabaseError.NOT_FOUND);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Group membership', function () {
|
||||
|
||||
Reference in New Issue
Block a user