Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'use strict';
var fixtures = require('haraka-test-fixtures');
var stub = fixtures.stub.stub;
var _set_up = function (done) {
this.backup = { plugin: { Syslog: {} } };
try {
this.plugin = new fixtures.plugin('log.syslog');
}
catch (e) {
console.log(e);
}
// stub out functions
this.log = stub();
this.log.level = 'INFO';
this.log.data = "this is a test log message";
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" },
'use strict';
// var Address = require('address-rfc2821');
const fixtures = require('haraka-test-fixtures');
const Connection = fixtures.connection;
const Transaction = fixtures.transaction;
const _set_up = function (done) {
this.plugin = new fixtures.plugin('rspamd');
this.plugin.register();
this.connection = Connection.createConnection();
this.connection.transaction = Transaction.createTransaction();
done();
};
exports.register = {
setUp : _set_up,
'loads the rspamd plugin': function (test) {
test.expect(1);
function _setup (done) {
this.plugin = new fixtures.plugin('queue/smtp_forward');
// switch config directory to 'tests/config'
this.plugin.config = this.plugin.config.module_config(path.resolve('tests'));
this.plugin.register();
this.connection = new fixtures.connection.createConnection();
this.connection.transaction = new fixtures.transaction.createTransaction();
done();
}
const _set_up = function (done) {
this.plugin = new fixtures.plugin('spf');
this.plugin.timeout = 8000;
this.plugin.load_spf_ini();
// uncomment this line to see detailed SPF evaluation
this.plugin.SPF.prototype.log_debug = () => {};
this.connection = fixtures.connection.createConnection();
this.connection.transaction = fixtures.transaction.createTransaction();
this.connection.transaction.results = new fixtures.results(this.connection);
done();
}
'use strict';
const Address = require('address-rfc2821').Address;
const fixtures = require('haraka-test-fixtures');
const stub = fixtures.stub.stub;
const Connection = fixtures.connection;
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 ],
};
'use strict';
// var Address = require('address-rfc2821');
const fixtures = require('haraka-test-fixtures');
const Connection = fixtures.connection;
const Transaction = fixtures.transaction;
const _set_up = function (done) {
this.plugin = new fixtures.plugin('rspamd');
this.plugin.register();
this.connection = Connection.createConnection();
this.connection.transaction = Transaction.createTransaction();
done();
};
exports.register = {
setUp : _set_up,
'loads the rspamd plugin': function (test) {
test.expect(1);
test.equal('rspamd', this.plugin.name);
const _set_up = function (done) {
this.plugin = new fixtures.plugin('spf');
this.plugin.timeout = 8000;
this.plugin.load_spf_ini();
// uncomment this line to see detailed SPF evaluation
this.plugin.SPF.prototype.log_debug = () => {};
this.connection = fixtures.connection.createConnection();
this.connection.transaction = fixtures.transaction.createTransaction();
this.connection.transaction.results = new fixtures.results(this.connection);
done();
}
function _setup (done) {
this.plugin = new fixtures.plugin('queue/smtp_forward');
// switch config directory to 'tests/config'
this.plugin.config = this.plugin.config.module_config(path.resolve('tests'));
this.plugin.register();
this.connection = new fixtures.connection.createConnection();
this.connection.transaction = new fixtures.transaction.createTransaction();
done();
}
var _set_up_redis = function (done) {
this.server = {};
this.plugin = new fixtures.plugin('rcpt_to.routes');
this.connection = fixtures.connection.createConnection();
this.connection.transaction = fixtures.transaction.createTransaction();
this.connection.transaction.results = new fixtures.results(this.connection);
this.plugin.register();
this.plugin.server = { notes: { } };
this.plugin.redisCfg.opts.retry_strategy = function (options) {
return;
};
var t = this;
this.plugin.init_redis_shared(function (err) {
if (err) {
console.error(err.message);
return done();
}
t.plugin.db = t.plugin.server.notes.redis;
t.plugin.redis_ping(function (err2, result) {