authelia/test/unitary/test_server_config.js

45 lines
1.0 KiB
JavaScript
Raw Normal View History

2017-03-15 22:07:57 +00:00
var sinon = require('sinon');
var server = require('../../src/lib/server');
var assert = require('assert');
describe('test server configuration', function() {
var deps;
var config;
before(function() {
config = {};
2017-03-15 22:07:57 +00:00
config.notifier = {
gmail: {
user: 'user@example.com',
pass: 'password'
}
}
transporter = {};
transporter.sendMail = sinon.stub().yields();
var nodemailer = {};
nodemailer.createTransport = sinon.spy(function() {
return transporter;
  });
deps = {};
2017-03-15 22:07:57 +00:00
deps.nedb = require('nedb');
deps.nodemailer = nodemailer;
deps.session = sinon.spy(function() {
return function(req, res, next) { next(); };
});
});
2017-03-15 22:07:57 +00:00
it('should set cookie scope to domain set in the config', function() {
config.session = {};
config.session.domain = 'example.com';
2017-03-15 22:07:57 +00:00
server.run(config, undefined, deps);
assert(deps.session.calledOnce);
assert.equal(deps.session.getCall(0).args[0].cookie.domain, 'example.com');
});
});