test: emails are not sent anymore
This commit is contained in:
@@ -11,7 +11,6 @@ var async = require('async'),
|
||||
expect = require('expect.js'),
|
||||
fs = require('fs'),
|
||||
groupdb = require('../groupdb.js'),
|
||||
groups = require('../groups.js'),
|
||||
mailboxdb = require('../mailboxdb.js'),
|
||||
maildb = require('../maildb.js'),
|
||||
mailer = require('../mailer.js'),
|
||||
@@ -30,7 +29,6 @@ var NEW_PASSWORD = 'oTHER@#$235';
|
||||
var DISPLAY_NAME = 'Nobody cares';
|
||||
var DISPLAY_NAME_NEW = 'Somone cares';
|
||||
var userObject = null;
|
||||
var NON_ADMIN_GROUP = 'members';
|
||||
var AUDIT_SOURCE = { ip: '1.2.3.4', userId: 'someuserid' };
|
||||
|
||||
const DOMAIN_0 = {
|
||||
@@ -727,74 +725,6 @@ describe('User', function () {
|
||||
});
|
||||
});
|
||||
|
||||
describe('admin change mail triggers', function () {
|
||||
let auditSource;
|
||||
|
||||
before(function (done) {
|
||||
createOwner(function (error, owner) {
|
||||
expect(error).to.not.be.ok();
|
||||
|
||||
auditSource = _.extend({}, AUDIT_SOURCE, { userId: owner.id });
|
||||
|
||||
groups.create(NON_ADMIN_GROUP, '', done);
|
||||
});
|
||||
});
|
||||
|
||||
after(cleanupUsers);
|
||||
|
||||
var user1 = {
|
||||
username: 'seconduser',
|
||||
password: 'ASDFkljsf#$^%2354',
|
||||
email: 'some@thi.ng',
|
||||
role: users.ROLE_ADMIN
|
||||
};
|
||||
|
||||
it('make second user admin does not send mail to action performer', function (done) {
|
||||
users.create(user1.username, user1.password, user1.email, DISPLAY_NAME, { }, auditSource, function (error, result) {
|
||||
expect(error).to.not.be.ok();
|
||||
expect(result).to.be.ok();
|
||||
|
||||
user1.id = result.id;
|
||||
|
||||
users.update(user1, { role: users.ROLE_ADMIN }, AUDIT_SOURCE, function (error) {
|
||||
expect(error).to.not.be.ok();
|
||||
|
||||
user1.role = users.ROLE_ADMIN;
|
||||
// no emails should be sent out anymore, since the user performing the action does not get a notification anymore
|
||||
checkMails(0, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('succeeds to remove admin flag does not send mail to action performer', function (done) {
|
||||
users.update(user1, { role: users.ROLE_USER }, auditSource, function (error) {
|
||||
expect(error).to.eql(null);
|
||||
|
||||
user1.role = users.ROLE_USER;
|
||||
// no emails should be sent out anymore, since the user performing the action does not get a notification anymore
|
||||
checkMails(0, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('make second user admin does send mail to other admins', function (done) {
|
||||
users.update(user1, { role: users.ROLE_ADMIN }, { ip: '1.2.3.4', userId: 'someuserid' }, function (error) {
|
||||
expect(error).to.not.be.ok();
|
||||
|
||||
user1.role = users.ROLE_ADMIN;
|
||||
checkMails(1, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('succeeds to remove admin flag does send mail to other admins', function (done) {
|
||||
users.update(user1, { role: users.ROLE_USER }, { ip: '1.2.3.4', userId: 'someuserid' }, function (error) {
|
||||
expect(error).to.eql(null);
|
||||
|
||||
user1.role = users.ROLE_USER;
|
||||
checkMails(1, done);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('get admins', function () {
|
||||
before(createOwner);
|
||||
after(cleanupUsers);
|
||||
|
||||
Reference in New Issue
Block a user