Add system tests to test the example from end user point of view

pull/50/head
Clement Michaud 2017-07-16 14:55:01 +02:00
parent 8f152d2328
commit 74cbfc637b
63 changed files with 233 additions and 119 deletions

View File

@ -14,12 +14,16 @@ module.exports = function (grunt) {
}, },
"test": { "test": {
cmd: "./node_modules/.bin/mocha", cmd: "./node_modules/.bin/mocha",
args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/client', 'test/server'] args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/unit']
}, },
"test-int": { "test-int": {
cmd: "./node_modules/.bin/mocha", cmd: "./node_modules/.bin/mocha",
args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/integration'] args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/integration']
}, },
"test-system": {
cmd: "./node_modules/.bin/mocha",
args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/system']
},
"docker-build": { "docker-build": {
cmd: "docker", cmd: "docker",
args: ['build', '-t', 'clems4ever/authelia', '.'] args: ['build', '-t', 'clems4ever/authelia', '.']

View File

@ -103,7 +103,7 @@ Deploy **Authelia** example with the following command:
npm install --only=dev npm install --only=dev
./node_modules/.bin/grunt build-dist ./node_modules/.bin/grunt build-dist
./scripts/deploy-example.sh ./scripts/example/deploy-example.sh
After few seconds the services should be running and you should be able to visit After few seconds the services should be running and you should be able to visit
[https://home.test.local:8080/](https://home.test.local:8080/). [https://home.test.local:8080/](https://home.test.local:8080/).

View File

@ -1,5 +0,0 @@
#!/bin/bash
set -e
docker-compose -f docker-compose.base.yml -f example/redis/docker-compose.yml -f example/ldap/docker-compose.yml -f test/integration/docker-compose.yml $*

View File

@ -1,4 +0,0 @@
#!/bin/bash
./scripts/dc-example.sh build
./scripts/dc-example.sh up -d

View File

@ -0,0 +1,6 @@
#!/bin/bash
DC_SCRIPT=./scripts/example/dc-example.sh
$DC_SCRIPT build
$DC_SCRIPT up -d

View File

@ -0,0 +1,5 @@
#!/bin/bash
DC_SCRIPT=./scripts/example/dc-example.sh
$DC_SCRIPT down

View File

@ -1,35 +1,54 @@
#!/bin/bash #!/bin/bash
DC_SCRIPT=./scripts/example/dc-example.sh
run_services() {
$DC_SCRIPT up -d redis openldap
sleep 2
$DC_SCRIPT up -d authelia nginx nginx-tests
sleep 3
}
set -e set -e
echo "Make sure services are not already running" echo "Make sure services are not already running"
./scripts/dc-example.sh down $DC_SCRIPT down
# Prepare & run integration tests
echo "Prepare nginx-test configuration" echo "Prepare nginx-test configuration"
cat example/nginx/nginx.conf | sed 's/listen 443 ssl/listen 8080 ssl/g' | dd of="test/integration/nginx.conf" cat example/nginx/nginx.conf | sed 's/listen 443 ssl/listen 8080 ssl/g' | dd of="test/integration/nginx.conf"
echo "Build services images..." echo "Build services images..."
./scripts/dc-example.sh build $DC_SCRIPT build
echo "Start services..." echo "Start services..."
./scripts/dc-example.sh up -d redis openldap run_services
sleep 2
./scripts/dc-example.sh up -d authelia nginx nginx-tests
sleep 3
docker ps -a docker ps -a
echo "Display services logs..." echo "Display services logs..."
./scripts/dc-example.sh logs redis $DC_SCRIPT logs redis
./scripts/dc-example.sh logs openldap $DC_SCRIPT logs openldap
./scripts/dc-example.sh logs nginx $DC_SCRIPT logs nginx
./scripts/dc-example.sh logs nginx-tests $DC_SCRIPT logs nginx-tests
./scripts/dc-example.sh logs authelia $DC_SCRIPT logs authelia
echo "Check number of services" echo "Check number of services"
./scripts/check-services.sh ./scripts/example/check-services.sh
echo "Run integration tests..." echo "Run integration tests..."
./scripts/dc-example.sh run --rm integration-tests $DC_SCRIPT run --rm integration-tests
echo "Shutdown services..." echo "Shutdown services..."
./scripts/dc-example.sh down $DC_SCRIPT down
# Prepare & test example from end user perspective
echo "Start services..."
run_services
./node_modules/.bin/mocha --compilers ts:ts-node/register --recursive test/system
$DC_SCRIPT down

View File

@ -1,3 +0,0 @@
#!/bin/bash
./scripts/dc-example.sh down

View File

@ -31,7 +31,7 @@ const redisOptions = {
}; };
describe("test example environment", function () { describe("integration tests", function () {
let redisClient: Redis.RedisClient; let redisClient: Redis.RedisClient;
before(function () { before(function () {

View File

@ -0,0 +1,92 @@
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
import Request = require("request");
import Assert = require("assert");
import BluebirdPromise = require("bluebird");
import Util = require("util");
import Endpoints = require("../../src/server/endpoints");
const RequestAsync = BluebirdPromise.promisifyAll(Request) as typeof Request;
const DOMAIN = "test.local";
const PORT = 8080;
const HOME_URL = Util.format("https://%s.%s:%d", "home", DOMAIN, PORT);
const SECRET_URL = Util.format("https://%s.%s:%d", "secret", DOMAIN, PORT);
const SECRET1_URL = Util.format("https://%s.%s:%d", "secret1", DOMAIN, PORT);
const SECRET2_URL = Util.format("https://%s.%s:%d", "secret2", DOMAIN, PORT);
const MX1_URL = Util.format("https://%s.%s:%d", "mx1.mail", DOMAIN, PORT);
const MX2_URL = Util.format("https://%s.%s:%d", "mx2.mail", DOMAIN, PORT);
const BASE_AUTH_URL = Util.format("https://%s.%s:%d", "auth", DOMAIN, PORT);
const FIRST_FACTOR_URL = Util.format("%s/api/firstfactor", BASE_AUTH_URL);
const LOGOUT_URL = Util.format("%s/logout", BASE_AUTH_URL);
describe("test example environment", function () {
function str_contains(str: string, pattern: string) {
return str.indexOf(pattern) != -1;
}
function test_homepage_is_correct(body: string) {
Assert(str_contains(body, BASE_AUTH_URL + Endpoints.LOGOUT_GET + "?redirect=" + HOME_URL + "/"));
Assert(str_contains(body, HOME_URL + "/secret.html"));
Assert(str_contains(body, SECRET_URL + "/secret.html"));
Assert(str_contains(body, SECRET1_URL + "/secret.html"));
Assert(str_contains(body, SECRET2_URL + "/secret.html"));
Assert(str_contains(body, MX1_URL + "/secret.html"));
Assert(str_contains(body, MX2_URL + "/secret.html"));
Assert(str_contains(body, "Access the secret"));
}
it("should access the home page", function () {
return RequestAsync.getAsync(HOME_URL)
.then(function (response: Request.RequestResponse) {
Assert.equal(200, response.statusCode);
test_homepage_is_correct(response.body);
});
});
it("should access the authentication page", function () {
return RequestAsync.getAsync(BASE_AUTH_URL)
.then(function (response: Request.RequestResponse) {
Assert.equal(200, response.statusCode);
Assert(response.body.indexOf("Sign in") > -1);
});
});
it("should fail first factor when wrong credentials are provided", function () {
return RequestAsync.postAsync(FIRST_FACTOR_URL, {
json: true,
body: {
username: "john",
password: "wrong password"
}
})
.then(function (response: Request.RequestResponse) {
Assert.equal(401, response.statusCode);
});
});
it("should redirect when correct credentials are provided during first factor", function () {
return RequestAsync.postAsync(FIRST_FACTOR_URL, {
json: true,
body: {
username: "john",
password: "password"
}
})
.then(function (response: Request.RequestResponse) {
Assert.equal(302, response.statusCode);
});
});
it("should redirect to home page when logout is called", function () {
return RequestAsync.getAsync(Util.format("%s?redirect=%s", LOGOUT_URL, HOME_URL))
.then(function (response: Request.RequestResponse) {
Assert.equal(200, response.statusCode);
Assert(response.body.indexOf("Access the secret") > -1);
});
});
});

View File

@ -1,5 +1,5 @@
import FirstFactorValidator = require("../../../src/client/firstfactor/FirstFactorValidator"); import FirstFactorValidator = require("../../../../src/client/firstfactor/FirstFactorValidator");
import JQueryMock = require("../mocks/jquery"); import JQueryMock = require("../mocks/jquery");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import Assert = require("assert"); import Assert = require("assert");

View File

@ -1,9 +1,9 @@
import Endpoints = require("../../../src/server/endpoints"); import Endpoints = require("../../../../src/server/endpoints");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import UISelectors = require("../../../src/client/firstfactor/UISelectors"); import UISelectors = require("../../../../src/client/firstfactor/UISelectors");
import firstfactor from "../../../src/client/firstfactor/index"; import firstfactor from "../../../../src/client/firstfactor/index";
import JQueryMock = require("../mocks/jquery"); import JQueryMock = require("../mocks/jquery");
import Assert = require("assert"); import Assert = require("assert");
import sinon = require("sinon"); import sinon = require("sinon");

View File

@ -1,5 +1,5 @@
import TOTPValidator = require("../../../src/client/secondfactor/TOTPValidator"); import TOTPValidator = require("../../../../src/client/secondfactor/TOTPValidator");
import JQueryMock = require("../mocks/jquery"); import JQueryMock = require("../mocks/jquery");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import Assert = require("assert"); import Assert = require("assert");

View File

@ -1,8 +1,8 @@
import U2FValidator = require("../../../src/client/secondfactor/U2FValidator"); import U2FValidator = require("../../../../src/client/secondfactor/U2FValidator");
import JQueryMock = require("../mocks/jquery"); import JQueryMock = require("../mocks/jquery");
import U2FApiMock = require("../mocks/u2f-api"); import U2FApiMock = require("../mocks/u2f-api");
import { SignMessage } from "../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage"; import { SignMessage } from "../../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage";
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import Assert = require("assert"); import Assert = require("assert");

View File

@ -2,8 +2,8 @@
import sinon = require("sinon"); import sinon = require("sinon");
import assert = require("assert"); import assert = require("assert");
import UISelector = require("../../../src/client/totp-register/ui-selector"); import UISelector = require("../../../../src/client/totp-register/ui-selector");
import TOTPRegister = require("../../../src/client/totp-register/totp-register"); import TOTPRegister = require("../../../../src/client/totp-register/totp-register");
describe("test totp-register", function() { describe("test totp-register", function() {
let jqueryMock: any; let jqueryMock: any;

View File

@ -1,8 +1,8 @@
import { AuthenticationRegulator } from "../../src/server/lib/AuthenticationRegulator"; import { AuthenticationRegulator } from "../../../src/server/lib/AuthenticationRegulator";
import UserDataStore from "../../src/server/lib/UserDataStore"; import UserDataStore from "../../../src/server/lib/UserDataStore";
import MockDate = require("mockdate"); import MockDate = require("mockdate");
import exceptions = require("../../src/server/lib/Exceptions"); import exceptions = require("../../../src/server/lib/Exceptions");
import nedb = require("nedb"); import nedb = require("nedb");
describe("test authentication regulator", function() { describe("test authentication regulator", function() {

View File

@ -1,6 +1,6 @@
import * as Assert from "assert"; import * as Assert from "assert";
import { UserConfiguration } from "../../src/types/Configuration"; import { UserConfiguration } from "../../../src/types/Configuration";
import ConfigurationAdapter from "../../src/server/lib/ConfigurationAdapter"; import ConfigurationAdapter from "../../../src/server/lib/ConfigurationAdapter";
describe("test config adapter", function() { describe("test config adapter", function() {
function build_yaml_config(): UserConfiguration { function build_yaml_config(): UserConfiguration {

View File

@ -2,9 +2,9 @@
import * as BluebirdPromise from "bluebird"; import * as BluebirdPromise from "bluebird";
import * as request from "request"; import * as request from "request";
import Server from "../../src/server/lib/Server"; import Server from "../../../src/server/lib/Server";
import { UserConfiguration } from "../../src/types/Configuration"; import { UserConfiguration } from "../../../src/types/Configuration";
import { GlobalDependencies } from "../../src/types/Dependencies"; import { GlobalDependencies } from "../../../src/types/Dependencies";
import * as tmp from "tmp"; import * as tmp from "tmp";
import U2FMock = require("./mocks/u2f"); import U2FMock = require("./mocks/u2f");
import { LdapjsClientMock } from "./mocks/ldapjs"; import { LdapjsClientMock } from "./mocks/ldapjs";

View File

@ -1,8 +1,8 @@
import sinon = require("sinon"); import sinon = require("sinon");
import IdentityValidator = require("../../src/server/lib/IdentityCheckMiddleware"); import IdentityValidator = require("../../../src/server/lib/IdentityCheckMiddleware");
import AuthenticationSession = require("../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../src/server/lib/AuthenticationSession");
import exceptions = require("../../src/server/lib/Exceptions"); import exceptions = require("../../../src/server/lib/Exceptions");
import assert = require("assert"); import assert = require("assert");
import winston = require("winston"); import winston = require("winston");
import Promise = require("bluebird"); import Promise = require("bluebird");

View File

@ -1,6 +1,6 @@
import LdapClient = require("../../src/server/lib/LdapClient"); import LdapClient = require("../../../src/server/lib/LdapClient");
import { LdapConfiguration } from "../../src/types/Configuration"; import { LdapConfiguration } from "../../../src/types/Configuration";
import sinon = require("sinon"); import sinon = require("sinon");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");

View File

@ -9,9 +9,9 @@ import u2f = require("u2f");
import nodemailer = require("nodemailer"); import nodemailer = require("nodemailer");
import session = require("express-session"); import session = require("express-session");
import { AppConfiguration, UserConfiguration } from "../../src/types/Configuration"; import { AppConfiguration, UserConfiguration } from "../../../src/types/Configuration";
import { GlobalDependencies, Nodemailer } from "../../src/types/Dependencies"; import { GlobalDependencies, Nodemailer } from "../../../src/types/Dependencies";
import Server from "../../src/server/lib/Server"; import Server from "../../../src/server/lib/Server";
describe("test server configuration", function () { describe("test server configuration", function () {

View File

@ -1,6 +1,6 @@
import SessionConfigurationBuilder from "../../src/server/lib/SessionConfigurationBuilder"; import SessionConfigurationBuilder from "../../../src/server/lib/SessionConfigurationBuilder";
import { AppConfiguration } from "../../src/types/Configuration"; import { AppConfiguration } from "../../../src/types/Configuration";
import { GlobalDependencies } from "../../src/types/Dependencies"; import { GlobalDependencies } from "../../../src/types/Dependencies";
import ExpressSession = require("express-session"); import ExpressSession = require("express-session");
import ConnectRedis = require("connect-redis"); import ConnectRedis = require("connect-redis");
import sinon = require("sinon"); import sinon = require("sinon");

View File

@ -1,5 +1,5 @@
import { TOTPValidator } from "../../src/server/lib/TOTPValidator"; import { TOTPValidator } from "../../../src/server/lib/TOTPValidator";
import sinon = require("sinon"); import sinon = require("sinon");
import Promise = require("bluebird"); import Promise = require("bluebird");
import SpeakeasyMock = require("./mocks/speakeasy"); import SpeakeasyMock = require("./mocks/speakeasy");

View File

@ -1,6 +1,6 @@
import UserDataStore from "../../src/server/lib/UserDataStore"; import UserDataStore from "../../../src/server/lib/UserDataStore";
import { U2FRegistrationDocument, Options } from "../../src/server/lib/UserDataStore"; import { U2FRegistrationDocument, Options } from "../../../src/server/lib/UserDataStore";
import nedb = require("nedb"); import nedb = require("nedb");
import assert = require("assert"); import assert = require("assert");

View File

@ -1,8 +1,8 @@
import assert = require("assert"); import assert = require("assert");
import winston = require("winston"); import winston = require("winston");
import { AccessController } from "../../../src/server/lib/access_control/AccessController"; import { AccessController } from "../../../../src/server/lib/access_control/AccessController";
import { ACLConfiguration } from "../../../src/types/Configuration"; import { ACLConfiguration } from "../../../../src/types/Configuration";
describe("test access control manager", function () { describe("test access control manager", function () {
let accessController: AccessController; let accessController: AccessController;

View File

@ -2,8 +2,8 @@
import assert = require("assert"); import assert = require("assert");
import winston = require("winston"); import winston = require("winston");
import PatternBuilder from "../../../src/server/lib/access_control/PatternBuilder"; import PatternBuilder from "../../../../src/server/lib/access_control/PatternBuilder";
import { ACLConfiguration } from "../../../src/types/Configuration"; import { ACLConfiguration } from "../../../../src/types/Configuration";
describe("test access control manager", function () { describe("test access control manager", function () {
describe("test access control pattern builder when no configuration is provided", () => { describe("test access control pattern builder when no configuration is provided", () => {

View File

@ -1,9 +1,9 @@
import sinon = require("sinon"); import sinon = require("sinon");
import { IdentityValidable } from "../../../src/server/lib/IdentityCheckMiddleware"; import { IdentityValidable } from "../../../../src/server/lib/IdentityCheckMiddleware";
import express = require("express"); import express = require("express");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import { Identity } from "../../../src/types/Identity"; import { Identity } from "../../../../src/types/Identity";
export interface IdentityValidableMock { export interface IdentityValidableMock {

View File

@ -1,6 +1,6 @@
import sinon = require("sinon"); import sinon = require("sinon");
import express = require("express"); import express = require("express");
import {  ServerVariables, VARIABLES_KEY }  from "../../../src/server/lib/ServerVariables"; import {  ServerVariables, VARIABLES_KEY }  from "../../../../src/server/lib/ServerVariables";
export interface ServerVariablesMock { export interface ServerVariablesMock {
logger: any; logger: any;

View File

@ -1,7 +1,7 @@
import * as sinon from "sinon"; import * as sinon from "sinon";
import * as assert from "assert"; import * as assert from "assert";
import { FileSystemNotifier } from "../../../src/server/lib/notifiers/FileSystemNotifier"; import { FileSystemNotifier } from "../../../../src/server/lib/notifiers/FileSystemNotifier";
import * as tmp from "tmp"; import * as tmp from "tmp";
import * as fs from "fs"; import * as fs from "fs";
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");

View File

@ -3,7 +3,7 @@ import * as assert from "assert";
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import NodemailerMock = require("../mocks/nodemailer"); import NodemailerMock = require("../mocks/nodemailer");
import GMailNotifier = require("../../../src/server/lib/notifiers/GMailNotifier"); import GMailNotifier = require("../../../../src/server/lib/notifiers/GMailNotifier");
describe("test gmail notifier", function () { describe("test gmail notifier", function () {

View File

@ -3,9 +3,9 @@ import * as sinon from "sinon";
import * as BluebirdPromise from "bluebird"; import * as BluebirdPromise from "bluebird";
import * as assert from "assert"; import * as assert from "assert";
import { NotifierFactory } from "../../../src/server/lib/notifiers/NotifierFactory"; import { NotifierFactory } from "../../../../src/server/lib/notifiers/NotifierFactory";
import { GMailNotifier } from "../../../src/server/lib/notifiers/GMailNotifier"; import { GMailNotifier } from "../../../../src/server/lib/notifiers/GMailNotifier";
import { FileSystemNotifier } from "../../../src/server/lib/notifiers/FileSystemNotifier"; import { FileSystemNotifier } from "../../../../src/server/lib/notifiers/FileSystemNotifier";
import NodemailerMock = require("../mocks/nodemailer"); import NodemailerMock = require("../mocks/nodemailer");

View File

@ -4,7 +4,7 @@ import request = require("request");
import assert = require("assert"); import assert = require("assert");
import express = require("express"); import express = require("express");
import nodemailer = require("nodemailer"); import nodemailer = require("nodemailer");
import Endpoints = require("../../src/server/endpoints"); import Endpoints = require("../../../src/server/endpoints");
import NodemailerMock = require("./mocks/nodemailer"); import NodemailerMock = require("./mocks/nodemailer");

View File

@ -4,10 +4,10 @@ import BluebirdPromise = require("bluebird");
import assert = require("assert"); import assert = require("assert");
import winston = require("winston"); import winston = require("winston");
import FirstFactorPost = require("../../../../src/server/lib/routes/firstfactor/post"); import FirstFactorPost = require("../../../../../src/server/lib/routes/firstfactor/post");
import exceptions = require("../../../../src/server/lib/Exceptions"); import exceptions = require("../../../../../src/server/lib/Exceptions");
import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession");
import Endpoints = require("../../../../src/server/endpoints"); import Endpoints = require("../../../../../src/server/endpoints");
import AuthenticationRegulatorMock = require("../../mocks/AuthenticationRegulator"); import AuthenticationRegulatorMock = require("../../mocks/AuthenticationRegulator");
import AccessControllerMock = require("../../mocks/AccessController"); import AccessControllerMock = require("../../mocks/AccessController");

View File

@ -1,6 +1,6 @@
import PasswordResetHandler from "../../../../../src/server/lib/routes/password-reset/identity/PasswordResetHandler"; import PasswordResetHandler from "../../../../../../src/server/lib/routes/password-reset/identity/PasswordResetHandler";
import LdapClient = require("../../../../../src/server/lib/LdapClient"); import LdapClient = require("../../../../../../src/server/lib/LdapClient");
import sinon = require("sinon"); import sinon = require("sinon");
import winston = require("winston"); import winston = require("winston");
import assert = require("assert"); import assert = require("assert");

View File

@ -1,7 +1,7 @@
import PasswordResetFormPost = require("../../../../src/server/lib/routes/password-reset/form/post"); import PasswordResetFormPost = require("../../../../../src/server/lib/routes/password-reset/form/post");
import LdapClient = require("../../../../src/server/lib/LdapClient"); import LdapClient = require("../../../../../src/server/lib/LdapClient");
import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession");
import sinon = require("sinon"); import sinon = require("sinon");
import winston = require("winston"); import winston = require("winston");
import assert = require("assert"); import assert = require("assert");

View File

@ -1,8 +1,8 @@
import sinon = require("sinon"); import sinon = require("sinon");
import winston = require("winston"); import winston = require("winston");
import RegistrationHandler from "../../../../../../src/server/lib/routes/secondfactor/totp/identity/RegistrationHandler"; import RegistrationHandler from "../../../../../../../src/server/lib/routes/secondfactor/totp/identity/RegistrationHandler";
import { Identity } from "../../../../../../src/types/Identity"; import { Identity } from "../../../../../../../src/types/Identity";
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
import assert = require("assert"); import assert = require("assert");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");

View File

@ -4,9 +4,9 @@ import sinon = require("sinon");
import assert = require("assert"); import assert = require("assert");
import winston = require("winston"); import winston = require("winston");
import exceptions = require("../../../../../../src/server/lib/Exceptions"); import exceptions = require("../../../../../../../src/server/lib/Exceptions");
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
import SignPost = require("../../../../../../src/server/lib/routes/secondfactor/totp/sign/post"); import SignPost = require("../../../../../../../src/server/lib/routes/secondfactor/totp/sign/post");
import ExpressMock = require("../../../../mocks/express"); import ExpressMock = require("../../../../mocks/express");
import UserDataStoreMock = require("../../../../mocks/UserDataStore"); import UserDataStoreMock = require("../../../../mocks/UserDataStore");

View File

@ -3,9 +3,9 @@ import winston = require("winston");
import assert = require("assert"); import assert = require("assert");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import { Identity } from "../../../../../../src/types/Identity"; import { Identity } from "../../../../../../../src/types/Identity";
import RegistrationHandler from "../../../../../../src/server/lib/routes/secondfactor/u2f/identity/RegistrationHandler"; import RegistrationHandler from "../../../../../../../src/server/lib/routes/secondfactor/u2f/identity/RegistrationHandler";
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
import ExpressMock = require("../../../../mocks/express"); import ExpressMock = require("../../../../mocks/express");
import UserDataStoreMock = require("../../../../mocks/UserDataStore"); import UserDataStoreMock = require("../../../../mocks/UserDataStore");

View File

@ -2,8 +2,8 @@
import sinon = require("sinon"); import sinon = require("sinon");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import assert = require("assert"); import assert = require("assert");
import U2FRegisterPost = require("../../../../../../src/server/lib/routes/secondfactor/u2f/register/post"); import U2FRegisterPost = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/register/post");
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
import winston = require("winston"); import winston = require("winston");
import ExpressMock = require("../../../../mocks/express"); import ExpressMock = require("../../../../mocks/express");

View File

@ -2,8 +2,8 @@
import sinon = require("sinon"); import sinon = require("sinon");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import assert = require("assert"); import assert = require("assert");
import U2FRegisterRequestGet = require("../../../../../../src/server/lib/routes/secondfactor/u2f/register_request/get"); import U2FRegisterRequestGet = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/register_request/get");
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
import winston = require("winston"); import winston = require("winston");
import ExpressMock = require("../../../../mocks/express"); import ExpressMock = require("../../../../mocks/express");

View File

@ -2,8 +2,8 @@
import sinon = require("sinon"); import sinon = require("sinon");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import assert = require("assert"); import assert = require("assert");
import U2FSignPost = require("../../../../../../src/server/lib/routes/secondfactor/u2f/sign/post"); import U2FSignPost = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/sign/post");
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
import winston = require("winston"); import winston = require("winston");
import ExpressMock = require("../../../../mocks/express"); import ExpressMock = require("../../../../mocks/express");

View File

@ -2,8 +2,8 @@
import sinon = require("sinon"); import sinon = require("sinon");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import assert = require("assert"); import assert = require("assert");
import U2FSignRequestGet = require("../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/get"); import U2FSignRequestGet = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/get");
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
import winston = require("winston"); import winston = require("winston");
import ExpressMock = require("../../../../mocks/express"); import ExpressMock = require("../../../../mocks/express");
@ -12,7 +12,7 @@ import ServerVariablesMock = require("../../../../mocks/ServerVariablesMock");
import U2FMock = require("../../../../mocks/u2f"); import U2FMock = require("../../../../mocks/u2f");
import U2f = require("u2f"); import U2f = require("u2f");
import { SignMessage } from "../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage"; import { SignMessage } from "../../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage";
describe("test u2f routes: sign_request", function () { describe("test u2f routes: sign_request", function () {
let req: ExpressMock.RequestMock; let req: ExpressMock.RequestMock;

View File

@ -1,7 +1,7 @@
import assert = require("assert"); import assert = require("assert");
import VerifyGet = require("../../../../src/server/lib/routes/verify/get"); import VerifyGet = require("../../../../../src/server/lib/routes/verify/get");
import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession"); import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession");
import sinon = require("sinon"); import sinon = require("sinon");
import winston = require("winston"); import winston = require("winston");

View File

@ -1,15 +1,15 @@
import Server from "../../../src/server/lib/Server"; import Server from "../../../../src/server/lib/Server";
import LdapClient = require("../../../src/server/lib/LdapClient"); import LdapClient = require("../../../../src/server/lib/LdapClient");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import speakeasy = require("speakeasy"); import speakeasy = require("speakeasy");
import request = require("request"); import request = require("request");
import nedb = require("nedb"); import nedb = require("nedb");
import { GlobalDependencies } from "../../../src/types/Dependencies"; import { GlobalDependencies } from "../../../../src/types/Dependencies";
import { TOTPSecret } from "../../../src/types/TOTPSecret"; import { TOTPSecret } from "../../../../src/types/TOTPSecret";
import U2FMock = require("./../mocks/u2f"); import U2FMock = require("./../mocks/u2f");
import Endpoints = require("../../../src/server/endpoints"); import Endpoints = require("../../../../src/server/endpoints");
import Requests = require("../requests"); import Requests = require("../requests");
import Assert = require("assert"); import Assert = require("assert");
import Sinon = require("sinon"); import Sinon = require("sinon");

View File

@ -1,15 +1,15 @@
import Server from "../../../src/server/lib/Server"; import Server from "../../../../src/server/lib/Server";
import LdapClient = require("../../../src/server/lib/LdapClient"); import LdapClient = require("../../../../src/server/lib/LdapClient");
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import speakeasy = require("speakeasy"); import speakeasy = require("speakeasy");
import Request = require("request"); import Request = require("request");
import nedb = require("nedb"); import nedb = require("nedb");
import { GlobalDependencies } from "../../../src/types/Dependencies"; import { GlobalDependencies } from "../../../../src/types/Dependencies";
import { TOTPSecret } from "../../../src/types/TOTPSecret"; import { TOTPSecret } from "../../../../src/types/TOTPSecret";
import U2FMock = require("./../mocks/u2f"); import U2FMock = require("./../mocks/u2f");
import Endpoints = require("../../../src/server/endpoints"); import Endpoints = require("../../../../src/server/endpoints");
import Requests = require("../requests"); import Requests = require("../requests");
import Assert = require("assert"); import Assert = require("assert");
import Sinon = require("sinon"); import Sinon = require("sinon");

View File

@ -1,17 +1,17 @@
import Server from "../../../src/server/lib/Server"; import Server from "../../../../src/server/lib/Server";
import LdapClient = require("../../../src/server/lib/LdapClient"); import LdapClient = require("../../../../src/server/lib/LdapClient");
import { LdapjsClientMock } from "./../mocks/ldapjs"; import { LdapjsClientMock } from "./../mocks/ldapjs";
import BluebirdPromise = require("bluebird"); import BluebirdPromise = require("bluebird");
import speakeasy = require("speakeasy"); import speakeasy = require("speakeasy");
import request = require("request"); import request = require("request");
import nedb = require("nedb"); import nedb = require("nedb");
import { GlobalDependencies } from "../../../src/types/Dependencies"; import { GlobalDependencies } from "../../../../src/types/Dependencies";
import { TOTPSecret } from "../../../src/types/TOTPSecret"; import { TOTPSecret } from "../../../../src/types/TOTPSecret";
import U2FMock = require("./../mocks/u2f"); import U2FMock = require("./../mocks/u2f");
import Endpoints = require("../../../src/server/endpoints"); import Endpoints = require("../../../../src/server/endpoints");
import Requests = require("../requests"); import Requests = require("../requests");
import Assert = require("assert"); import Assert = require("assert");
import Sinon = require("sinon"); import Sinon = require("sinon");

View File

@ -3,7 +3,7 @@ import * as assert from "assert";
import * as Promise from "bluebird"; import * as Promise from "bluebird";
import * as sinon from "sinon"; import * as sinon from "sinon";
import * as MockDate from "mockdate"; import * as MockDate from "mockdate";
import UserDataStore from "../../../src/server/lib/UserDataStore"; import UserDataStore from "../../../../src/server/lib/UserDataStore";
import nedb = require("nedb"); import nedb = require("nedb");
describe("test user data store", function() { describe("test user data store", function() {

View File

@ -3,7 +3,7 @@ import * as assert from "assert";
import * as Promise from "bluebird"; import * as Promise from "bluebird";
import * as sinon from "sinon"; import * as sinon from "sinon";
import * as MockDate from "mockdate"; import * as MockDate from "mockdate";
import UserDataStore from "../../../src/server/lib/UserDataStore"; import UserDataStore from "../../../../src/server/lib/UserDataStore";
import nedb = require("nedb"); import nedb = require("nedb");
describe("test user data store", function() { describe("test user data store", function() {