2017-07-24 22:08:12 +02:00
|
|
|
const helpers = require("../global-setup");
|
|
|
|
const path = require("path");
|
|
|
|
const request = require("request");
|
|
|
|
const serverBasicAuth = require("../../servers/basic-auth.js");
|
|
|
|
|
|
|
|
const expect = require("chai").expect;
|
|
|
|
|
|
|
|
const describe = global.describe;
|
|
|
|
const it = global.it;
|
|
|
|
const beforeEach = global.beforeEach;
|
|
|
|
const afterEach = global.afterEach;
|
|
|
|
|
|
|
|
describe("Calendar module", function() {
|
|
|
|
helpers.setupTimeout(this);
|
|
|
|
|
|
|
|
var app = null;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
return helpers
|
|
|
|
.startApplication({
|
|
|
|
args: ["js/electron.js"]
|
|
|
|
})
|
|
|
|
.then(function(startedApp) {
|
|
|
|
app = startedApp;
|
|
|
|
});
|
2017-03-10 03:25:16 -03:00
|
|
|
});
|
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
afterEach(function() {
|
|
|
|
return helpers.stopApplication(app);
|
2017-03-10 03:25:16 -03:00
|
|
|
});
|
|
|
|
|
|
|
|
describe("Default configuration", function() {
|
|
|
|
before(function() {
|
|
|
|
// Set config sample for use in test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
|
|
|
|
});
|
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
it("Should return TestEvents", function() {
|
2017-03-10 03:25:16 -03:00
|
|
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-03-10 04:33:27 -03:00
|
|
|
describe("Basic auth", function() {
|
|
|
|
before(function() {
|
|
|
|
serverBasicAuth.listen(8010);
|
|
|
|
// Set config sample for use in test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
|
|
|
|
});
|
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
after(function(done) {
|
|
|
|
serverBasicAuth.close(done());
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should return TestEvents", function() {
|
2017-03-10 04:33:27 -03:00
|
|
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-03-10 04:36:09 -03:00
|
|
|
describe("Basic auth by default", function() {
|
|
|
|
before(function() {
|
|
|
|
serverBasicAuth.listen(8011);
|
|
|
|
// Set config sample for use in test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
|
|
|
|
});
|
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
after(function(done) {
|
|
|
|
serverBasicAuth.close(done());
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should return TestEvents", function() {
|
2017-03-10 04:36:09 -03:00
|
|
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-07-31 17:18:34 -04:00
|
|
|
describe("Basic auth backward compatibilty configuration: DEPRECATED", function() {
|
2017-03-10 04:40:59 -03:00
|
|
|
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";
|
|
|
|
});
|
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
after(function(done) {
|
|
|
|
serverBasicAuth.close(done());
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should return TestEvents", function() {
|
2017-03-10 04:40:59 -03:00
|
|
|
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-03-10 16:45:45 -03:00
|
|
|
describe("Fail Basic auth", function() {
|
|
|
|
before(function() {
|
|
|
|
serverBasicAuth.listen(8020);
|
|
|
|
// Set config sample for use in test
|
|
|
|
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/fail-basic-auth.js";
|
|
|
|
});
|
|
|
|
|
2017-07-24 22:08:12 +02:00
|
|
|
after(function(done) {
|
|
|
|
serverBasicAuth.close(done());
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should return No upcoming events", function() {
|
2017-03-10 16:45:45 -03:00
|
|
|
return app.client.waitUntilTextExists(".calendar", "No upcoming events.", 10000);
|
|
|
|
});
|
|
|
|
});
|
2017-03-10 03:25:16 -03:00
|
|
|
});
|