Fix issues with integration tests in master

This commit is contained in:
Clement Michaud 2018-07-24 23:36:04 +02:00
parent f67bb69ee0
commit 1e0a279179
7 changed files with 11 additions and 14 deletions

View File

@ -15,7 +15,7 @@ export class TotpHandler implements ITotpHandler {
generate(label: string, issuer: string): TOTPSecret { generate(label: string, issuer: string): TOTPSecret {
const secret = this.speakeasy.generateSecret({ const secret = this.speakeasy.generateSecret({
otpauth_url: false otpauth_url: false
}); }) as TOTPSecret;
secret.otpauth_url = this.speakeasy.otpauthURL({ secret.otpauth_url = this.speakeasy.otpauthURL({
secret: secret.ascii, secret: secret.ascii,

View File

@ -1,7 +1,6 @@
import express = require("express"); import express = require("express");
import objectPath = require("object-path"); import objectPath = require("object-path");
import winston = require("winston");
import Endpoints = require("../../../../../shared/api"); import Endpoints = require("../../../../../shared/api");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import { AuthenticationSessionHandler } from "../../AuthenticationSessionHandler"; import { AuthenticationSessionHandler } from "../../AuthenticationSessionHandler";

View File

@ -1,7 +1,6 @@
import express = require("express"); import express = require("express");
import objectPath = require("object-path"); import objectPath = require("object-path");
import winston = require("winston");
import Endpoints = require("../../../../../shared/api"); import Endpoints = require("../../../../../shared/api");
import { ServerVariables } from "../../ServerVariables"; import { ServerVariables } from "../../ServerVariables";
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");

View File

@ -6,7 +6,7 @@ import { MongoClientStub } from "../../mocks/connectors/mongo/MongoClientStub";
import { MongoCollection } from "../../../src/lib/storage/mongo/MongoCollection"; import { MongoCollection } from "../../../src/lib/storage/mongo/MongoCollection";
describe("MongoCollection", function () { describe("MongoCollection", function () {
let mongoCollectionStub: MongoDB.Collection<any>; let mongoCollectionStub: any;
let findStub: Sinon.SinonStub; let findStub: Sinon.SinonStub;
let findOneStub: Sinon.SinonStub; let findOneStub: Sinon.SinonStub;
let insertStub: Sinon.SinonStub; let insertStub: Sinon.SinonStub;
@ -15,8 +15,7 @@ describe("MongoCollection", function () {
let countStub: Sinon.SinonStub; let countStub: Sinon.SinonStub;
before(function () { before(function () {
const Collection = require("mongodb").Collection; mongoCollectionStub = Sinon.createStubInstance(require("mongodb").Collection as any);
mongoCollectionStub = Sinon.createStubInstance(Collection);
findStub = mongoCollectionStub.find as Sinon.SinonStub; findStub = mongoCollectionStub.find as Sinon.SinonStub;
findOneStub = mongoCollectionStub.findOne as Sinon.SinonStub; findOneStub = mongoCollectionStub.findOne as Sinon.SinonStub;
insertStub = mongoCollectionStub.insert as Sinon.SinonStub; insertStub = mongoCollectionStub.insert as Sinon.SinonStub;

View File

@ -64,7 +64,7 @@ When("I visit {string} and get redirected {string}",
const that = this; const that = this;
return this.driver.get(url) return this.driver.get(url)
.then(function () { .then(function () {
return that.driver.wait(seleniumWebdriver.until.urlIs(redirectUrl), 2000); return that.driver.wait(seleniumWebdriver.until.urlIs(redirectUrl), 6000);
}); });
}); });

View File

@ -60,14 +60,14 @@ function declareNeedsConfiguration(tag: string, cb: () => BluebirdPromise<void>)
.then(function () { .then(function () {
return exec("./scripts/example-commit/dc-example.sh -f " + return exec("./scripts/example-commit/dc-example.sh -f " +
"./example/compose/authelia/docker-compose.test.yml up -d authelia &&" + "./example/compose/authelia/docker-compose.test.yml up -d authelia &&" +
" sleep 1"); " sleep 3");
}) })
}); });
After({ tags: "@needs-" + tag + "-config", timeout: 20 * 1000 }, function () { After({ tags: "@needs-" + tag + "-config", timeout: 20 * 1000 }, function () {
return exec("rm config.test.yml") return exec("rm config.test.yml")
.then(function () { .then(function () {
return exec("./scripts/example-commit/dc-example.sh up -d authelia && sleep 1"); return exec("./scripts/example-commit/dc-example.sh up -d authelia && sleep 3");
}); });
}); });
} }

View File

@ -6,5 +6,5 @@ import BluebirdPromise = require("bluebird");
When(/^the application restarts$/, {timeout: 15 * 1000}, function () { When(/^the application restarts$/, {timeout: 15 * 1000}, function () {
const exec = BluebirdPromise.promisify(ChildProcess.exec); const exec = BluebirdPromise.promisify(ChildProcess.exec);
return exec("./scripts/example-commit/dc-example.sh restart authelia && sleep 1"); return exec("./scripts/example-commit/dc-example.sh restart authelia && sleep 3");
}); });