mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 04:02:12 +00:00
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.
This commit is contained in:
parent
a15b8077a3
commit
11fe6cfbb0
25
tests/configs/empty_ipWhiteList.js
Normal file
25
tests/configs/empty_ipWhiteList.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/* Magic Mirror Test config sample ipWhitelist
|
||||||
|
*
|
||||||
|
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||||
|
* MIT Licensed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
port: 8080,
|
||||||
|
ipWhitelist: [],
|
||||||
|
|
||||||
|
language: "en",
|
||||||
|
timeFormat: 24,
|
||||||
|
units: "metric",
|
||||||
|
electronOptions: {
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
modules: [
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||||
|
if (typeof module !== "undefined") {module.exports = config;}
|
@ -4,15 +4,11 @@ const request = require("request");
|
|||||||
const chai = require("chai");
|
const chai = require("chai");
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
|
||||||
describe("Set ipWhitelist without access", function () {
|
|
||||||
|
describe("ipWhitelist directive configuration", function () {
|
||||||
|
|
||||||
this.timeout(20000);
|
this.timeout(20000);
|
||||||
|
|
||||||
before(function() {
|
|
||||||
// Set config sample for use in test
|
|
||||||
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(function (done) {
|
beforeEach(function (done) {
|
||||||
app.start().then(function() { done(); } );
|
app.start().then(function() { done(); } );
|
||||||
});
|
});
|
||||||
@ -21,10 +17,30 @@ describe("Set ipWhitelist without access", function () {
|
|||||||
app.stop().then(function() { done(); });
|
app.stop().then(function() { done(); });
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should return 403", function (done) {
|
describe("Set ipWhitelist without access", function () {
|
||||||
request.get("http://localhost:8080", function (err, res, body) {
|
before(function() {
|
||||||
expect(res.statusCode).to.equal(403);
|
// Set config sample for use in test
|
||||||
done();
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user