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";
'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 dns = require('dns');
var fixtures = require('haraka-test-fixtures');
var stub = fixtures.stub.stub;
var _set_up = function (done) {
this.plugin = new fixtures.plugin('connect.fcrdns');
this.plugin.register();
this.connection = fixtures.connection.createConnection();
this.connection.auth_results = stub();
this.plugin.hook_connect_init(function () {
done();
}, this.connection);
};
exports.refresh_config = {
setUp : _set_up,
'use strict';
const events = require('events');
const fixtures = require('haraka-test-fixtures');
const stub = fixtures.stub.stub;
class Socket extends events.EventEmitter {
constructor (port, host) {
super();
this.port = port;
this.host = host;
this.setTimeout = stub();
this.setKeepAlive = stub();
this.destroy = stub();
}
}
exports.Socket = Socket;
exports.connect = (port, host, cb) => new Socket(port, host)
'use strict';
const Address = require('address-rfc2821');
const fixtures = require('haraka-test-fixtures');
const Connection = fixtures.connection;
const stub = fixtures.stub.stub;
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();
}
exports.register = {
setUp : _set_up,
'loads the spamassassin plugin' (test) {
'use strict';
const path = require('path');
const fixtures = require('haraka-test-fixtures');
const stub = fixtures.stub.stub;
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();
}
exports.init = {
setUp: _set_up,
'use strict';
var Address = require('address-rfc2821').Address;
var fixtures = require('haraka-test-fixtures');
var Connection = fixtures.connection;
var ResultStore = fixtures.result_store;
var stub = fixtures.stub.stub;
var _set_up = function (done) {
this.plugin = new fixtures.plugin('karma');
this.plugin.cfg = { main: {} };
this.plugin.deny_hooks = {'connect': true};
this.plugin.tarpit_hooks = ['connect'];
this.connection = Connection.createConnection({}, { notes: {} });
this.connection.transaction = stub;
this.connection.transaction.results = new ResultStore(this.plugin);
done();
};
'use strict';
var fixtures = require('haraka-test-fixtures');
var Connection = fixtures.connection;
var stub = fixtures.stub.stub;
var _set_up = function (done) {
this.plugin = new fixtures.plugin('limit');
this.plugin.cfg = { main: {} };
this.connection = Connection.createConnection();
this.connection.transaction = stub;
this.plugin.register();
done();
};
exports.login_init = {
setUp : _set_up,