MagicMirror/tests/e2e/ipWhistlist_spec.js
Rodrigo Ramírez Norambuena 11fe6cfbb0 Add test ipWhistelist = []
This test ipWhistelist on [] to access all IPs
Creates a request to localhost and port added in configuration and
check if gets 200 HTTP code.
2017-03-08 10:30:27 -03:00

47 lines
1.1 KiB
JavaScript

const globalSetup = require("./global-setup");
const app = globalSetup.app;
const request = require("request");
const chai = require("chai");
const expect = chai.expect;
describe("ipWhitelist directive configuration", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
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();
});
});
});
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();
});
});
});
});