How to use the haraka-test-fixtures.plugin function in haraka-test-fixtures

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 / 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 / relay.js View on Github external
function _set_up (done) {

    this.plugin = new fixtures.plugin('relay');
    this.plugin.cfg = {};
    this.connection = fixtures.connection.createConnection();

    done();
}
github haraka / Haraka / tests / plugins / rcpt_to.ldap.js View on Github external
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();
};
github haraka / Haraka / tests / plugins / dkim_signer.js View on Github external
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) {
github haraka / Haraka / tests / plugins / auth / auth_base.js View on Github external
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 = [];
github haraka / Haraka / tests / plugins / helo.checks.js View on Github external
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();
}
github haraka / Haraka / tests / plugins / rcpt_to.routes.js View on Github external
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();
};
github haraka / Haraka / tests / plugins / early_talker.js View on Github external
function _set_up (done) {

    this.plugin = new fixtures.plugin('early_talker');
    this.plugin.cfg = { main: { reject: true } };

    this.connection = fixtures.connection.createConnection();
    done();
}
github haraka / Haraka / tests / plugins / bounce.js View on Github external
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 },
    };
github haraka / Haraka / tests / plugins / spamassassin.js View on Github external
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();
}

haraka-test-fixtures

Haraka Test Fixtures

MIT
Latest version published 11 days ago

Package Health Score

70 / 100
Full package analysis

Similar packages