2017-03-07 16:21:15 -03:00
|
|
|
const globalSetup = require("./global-setup");
|
|
|
|
const app = globalSetup.app;
|
|
|
|
const request = require("request");
|
|
|
|
const chai = require("chai");
|
|
|
|
const expect = chai.expect;
|
|
|
|
|
|
|
|
|
2017-03-07 21:22:27 -03:00
|
|
|
describe("ipWhitelist directive configuration", function () {
|
2017-03-07 16:21:15 -03:00
|
|
|
|
2017-03-07 21:22:27 -03:00
|
|
|
this.timeout(20000);
|
2017-03-07 16:21:15 -03:00
|
|
|
|
|
|
|
beforeEach(function (done) {
|
|
|
|
app.start().then(function() { done(); } );
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function (done) {
|
|
|
|
app.stop().then(function() { done(); });
|
|
|
|
});
|
|
|
|
|
2017-03-07 21:22:27 -03:00
|
|
|
describe("Set ipWhitelist without access", function () {
|
|
|
|
before(function() {
|
|
|
|
// Set config sample for use in test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
|
|
|
});
|
|
|
|
it("should return 403", function (done) {
|
|
|
|
request.get("http://localhost:8080", function (err, res, body) {
|
|
|
|
expect(res.statusCode).to.equal(403);
|
|
|
|
done();
|
|
|
|
});
|
2017-03-07 16:21:15 -03:00
|
|
|
});
|
|
|
|
});
|
2017-03-07 21:22:27 -03:00
|
|
|
|
|
|
|
describe("Set ipWhitelist []", function () {
|
|
|
|
before(function() {
|
|
|
|
// Set config sample for use in test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
|
|
|
});
|
|
|
|
it("should return 200", function (done) {
|
|
|
|
request.get("http://localhost:8080", function (err, res, body) {
|
|
|
|
expect(res.statusCode).to.equal(200);
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-03-07 16:21:15 -03:00
|
|
|
});
|