mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-29 12:39:45 +00:00
Test check backward backward compatibility authentication method basic
on calendar module Fix travis basic-auth server
This commit is contained in:
parent
f5c57e84c7
commit
b129fe908c
39
tests/configs/modules/calendar/old-basic-auth.js
Normal file
39
tests/configs/modules/calendar/old-basic-auth.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/* Magic Mirror Test config default calendar
|
||||||
|
* with authenticacion old config
|
||||||
|
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
|
||||||
|
* MIT Licensed.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
port: 8080,
|
||||||
|
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
|
||||||
|
|
||||||
|
language: "en",
|
||||||
|
timeFormat: 12,
|
||||||
|
units: "metric",
|
||||||
|
electronOptions: {
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
modules: [
|
||||||
|
{
|
||||||
|
module: "calendar",
|
||||||
|
position: "bottom_bar",
|
||||||
|
config: {
|
||||||
|
calendars: [
|
||||||
|
{
|
||||||
|
maximumNumberOfDays: 10000,
|
||||||
|
url: "http://localhost:8012/tests/configs/data/calendar_test.ics",
|
||||||
|
user: "MagicMirror",
|
||||||
|
pass: "CallMeADog"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||||
|
if (typeof module !== "undefined") {module.exports = config;}
|
@ -53,5 +53,18 @@ describe("Calendar module", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Basic auth backward compatibilty configuration", function() {
|
||||||
|
before(function() {
|
||||||
|
serverBasicAuth.listen(8012);
|
||||||
|
// Set config sample for use in test
|
||||||
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should return TestEvents", function () {
|
||||||
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -5,10 +5,9 @@ var express = require("express")
|
|||||||
|
|
||||||
var basic = auth.basic({
|
var basic = auth.basic({
|
||||||
realm: "MagicMirror Area restricted."
|
realm: "MagicMirror Area restricted."
|
||||||
}, (username, password, callback) => {
|
}, (username, password, callback) => {
|
||||||
callback(username === "MagicMirror" && password === "CallMeADog");
|
callback(username === "MagicMirror" && password === "CallMeADog");
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
this.server = express();
|
this.server = express();
|
||||||
this.server.use(auth.connect(basic));
|
this.server.use(auth.connect(basic));
|
||||||
@ -16,10 +15,10 @@ this.server.use(auth.connect(basic));
|
|||||||
// Set directories availables
|
// Set directories availables
|
||||||
var directories = ["/tests/configs"];
|
var directories = ["/tests/configs"];
|
||||||
var directory;
|
var directory;
|
||||||
root_path = path.resolve(__dirname + "/../../");
|
rootPath = path.resolve(__dirname + "/../../");
|
||||||
for (i in directories) {
|
for (i in directories) {
|
||||||
directory = directories[i];
|
directory = directories[i];
|
||||||
this.server.use(directory, express.static(path.resolve(root_path + directory)));
|
this.server.use(directory, express.static(path.resolve(rootPath + directory)));
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.listen = function () {
|
exports.listen = function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user