How to use haraka-test-fixtures - 10 common examples

To help you get started, we’ve selected a few haraka-test-fixtures examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github haraka / Haraka / tests / plugins / log.syslog.js View on Github external
'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";
github haraka / Haraka / tests / plugins / aliases.js View on Github external
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" },
github haraka / Haraka / tests / plugins / rspamd.js View on Github external
'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);
github haraka / Haraka / tests / plugins / queue / smtp_forward.js View on Github external
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();
}
github haraka / Haraka / tests / plugins / spf.js View on Github external
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();
}
github haraka / Haraka / tests / plugins / aliases.js View on Github external
'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 ],
    };
github haraka / Haraka / tests / plugins / rspamd.js View on Github external
'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);
github haraka / Haraka / tests / plugins / spf.js View on Github external
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();
}
github haraka / Haraka / tests / plugins / queue / smtp_forward.js View on Github external
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();
}
github haraka / Haraka / tests / plugins / rcpt_to.routes.js View on Github external
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) {

haraka-test-fixtures

Haraka Test Fixtures

MIT
Latest version published 3 months ago

Package Health Score

62 / 100
Full package analysis

Similar packages