Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const _set_up = function (done) {
// needed for tests
this.plugin = new fixtures.plugin('aliases');
this.recip = new Address('');
this.params = [this.recip];
this.connection = Connection.createConnection();
this.connection.loginfo = stub();
this.connection.transaction = {
notes: stub(),
rcpt_to: [ this.params ],
};
// some test data
this.configfile = {
"test1" : { "action" : "drop" },
"test2" : { "action" : "drop" },
"test2-specific" : { "action" : "alias", "to" : "test2" },
"test3" : { "action" : "alias", "to" : "test3-works" },
function _set_up (done) {
this.plugin = new fixtures.plugin('relay');
this.plugin.cfg = {};
this.connection = fixtures.connection.createConnection();
done();
}
const _set_up = function (done) {
this.plugin = new fixtures.plugin('rcpt_to.ldap');
this.plugin.inherits('rcpt_to.host_list_base');
this.plugin.cfg = {};
this.plugin.host_list = {};
this.connection = fixtures.connection.createConnection();
this.connection.transaction = {
results: new fixtures.results(this.connection),
notes: {},
rcpt_to: [new Address('test@test.com')]
};
done();
};
setUp (done) {
this.plugin = new fixtures.plugin('dkim_sign');
this.plugin.load_dkim_sign_ini();
props.headers = this.plugin.cfg.headers_to_sign;
done()
},
'body hash simple' (test) {
function _set_up_custom_pwcb_opts (done) {
this.plugin = new fixtures.plugin('auth/auth_base');
this.plugin.check_plain_passwd = (connection, user, passwd, pwok_cb) => {
switch (user) {
case 'legacyok_nomessage': return pwok_cb(true);
case 'legacyfail_nomessage': return pwok_cb(false);
case 'legacyok_message': return pwok_cb(true, 'GREAT SUCCESS');
case 'legacyfail_message': return pwok_cb(false, 'FAIL 123');
case 'newok': return pwok_cb(true, {message: 'KOKOKO', code: 215});
case 'newfail': return pwok_cb(false, {message: 'OHOHOH', code: 555});
default: throw 'what?!';
}
};
this.connection = fixtures.connection.createConnection();
this.connection.capabilities=null;
this.connection.notes.resp_strings = [];
const _set_up = function (done) {
this.plugin = new fixtures.plugin('helo.checks');
this.plugin.config.root_path = path.resolve(__dirname, '../../config');
this.connection = fixtures.connection.createConnection();
this.connection.remote.ip='208.75.199.19';
this.plugin.register();
done();
}
var _set_up_file = function (done) {
this.server = {};
this.plugin = new fixtures.plugin('rcpt_to.routes');
this.plugin.register();
this.connection = fixtures.connection.createConnection();
this.connection.transaction = fixtures.transaction.createTransaction();
this.connection.transaction.results = new fixtures.results(this.connection);
done();
};
function _set_up (done) {
this.plugin = new fixtures.plugin('early_talker');
this.plugin.cfg = { main: { reject: true } };
this.connection = fixtures.connection.createConnection();
done();
}
function _set_up (done) {
this.plugin = new fixtures.plugin('bounce');
this.plugin.cfg = {
main: { },
check: {
reject_all: false,
single_recipient: true,
empty_return_path: true,
bad_rcpt: true,
non_local_msgid: true,
},
reject: {
single_recipient:true,
empty_return_path:true,
non_local_msgid:true,
},
invalid_addrs: { 'test@bad1.com': true, 'test@bad2.com': true },
};
function _set_up (done) {
this.plugin = new fixtures.plugin('spamassassin');
this.plugin.cfg = { main: { spamc_auth_header: 'X-Haraka-Relaying123' } };
this.connection = Connection.createConnection();
this.connection.transaction = stub;
this.connection.transaction.notes = {};
done();
}