From 74cbfc637bd9a17df3f6baedd22faacac4df9f6f Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Sun, 16 Jul 2017 14:55:01 +0200 Subject: [PATCH] Add system tests to test the example from end user point of view --- Gruntfile.js | 6 +- README.md | 2 +- scripts/dc-test.sh | 5 - scripts/deploy-example.sh | 4 - scripts/{ => example}/check-services.sh | 0 scripts/{ => example}/dc-example.sh | 0 scripts/example/deploy-example.sh | 6 ++ scripts/example/undeploy-example.sh | 5 + scripts/integration-tests.sh | 47 +++++++--- scripts/undeploy-example.sh | 3 - test/integration/main.ts | 2 +- test/system/main.ts | 92 +++++++++++++++++++ .../firstfactor/FirstFactorValidator.test.ts | 2 +- .../client/firstfactor/login.test.ts | 6 +- test/{ => unit}/client/mocks/jquery.ts | 0 test/{ => unit}/client/mocks/u2f-api.ts | 0 .../client/secondfactor/TOTPValidator.test.ts | 2 +- .../client/secondfactor/U2FValidator.test.ts | 4 +- .../totp-register/totp-register.test.ts | 4 +- .../server/AuthenticationRegulator.test.ts | 6 +- .../server/ConfigurationAdapter.test.ts | 4 +- .../{ => unit}/server/DataPersistence.test.ts | 6 +- .../server/IdentityCheckMiddleware.test.ts | 6 +- test/{ => unit}/server/LdapClient.test.ts | 4 +- .../server/ServerConfiguration.test.ts | 6 +- .../SessionConfigurationBuilder.test.ts | 6 +- test/{ => unit}/server/TOTPValidator.test.ts | 2 +- test/{ => unit}/server/UserDataStore.test.ts | 4 +- .../access_control/AccessController.test.ts | 4 +- .../access_control/PatternBuilder.test.ts | 4 +- .../server/mocks/AccessController.ts | 0 .../server/mocks/AuthenticationRegulator.ts | 0 .../server/mocks/IdentityValidator.ts | 4 +- test/{ => unit}/server/mocks/LdapClient.ts | 0 test/{ => unit}/server/mocks/Notifier.ts | 0 .../server/mocks/ServerVariablesMock.ts | 2 +- test/{ => unit}/server/mocks/TOTPValidator.ts | 0 test/{ => unit}/server/mocks/UserDataStore.ts | 0 test/{ => unit}/server/mocks/express.ts | 0 test/{ => unit}/server/mocks/ldapjs.ts | 0 test/{ => unit}/server/mocks/nodemailer.ts | 0 test/{ => unit}/server/mocks/speakeasy.ts | 0 test/{ => unit}/server/mocks/u2f.ts | 0 .../notifiers/FileSystemNotifier.test.ts | 2 +- .../server/notifiers/GMailNotifier.test.ts | 2 +- .../server/notifiers/NotifierFactory.test.ts | 6 +- test/{ => unit}/server/requests.ts | 2 +- .../server/routes/firstfactor/post.test.ts | 8 +- .../identity/PasswordResetHandler.test.ts | 4 +- .../server/routes/password-reset/post.test.ts | 6 +- .../totp/register/RegistrationHandler.test.ts | 6 +- .../secondfactor/totp/sign/post.test.ts | 6 +- .../u2f/identity/RegistrationHandler.test.ts | 6 +- .../secondfactor/u2f/register/post.test.ts | 4 +- .../u2f/register_request/get.test.ts | 4 +- .../routes/secondfactor/u2f/sign/post.test.ts | 4 +- .../secondfactor/u2f/sign_request/get.test.ts | 6 +- .../server/routes/verify/get.test.ts | 4 +- test/{ => unit}/server/server/PrivatePages.ts | 10 +- test/{ => unit}/server/server/PublicPages.ts | 10 +- test/{ => unit}/server/server/Server.test.ts | 10 +- .../authentication_audit.test.ts | 2 +- .../user_data_store/totp_secret.test.ts | 2 +- 63 files changed, 233 insertions(+), 119 deletions(-) delete mode 100755 scripts/dc-test.sh delete mode 100755 scripts/deploy-example.sh rename scripts/{ => example}/check-services.sh (100%) rename scripts/{ => example}/dc-example.sh (100%) create mode 100755 scripts/example/deploy-example.sh create mode 100755 scripts/example/undeploy-example.sh delete mode 100755 scripts/undeploy-example.sh create mode 100644 test/system/main.ts rename test/{ => unit}/client/firstfactor/FirstFactorValidator.test.ts (94%) rename test/{ => unit}/client/firstfactor/login.test.ts (93%) rename test/{ => unit}/client/mocks/jquery.ts (100%) rename test/{ => unit}/client/mocks/u2f-api.ts (100%) rename test/{ => unit}/client/secondfactor/TOTPValidator.test.ts (94%) rename test/{ => unit}/client/secondfactor/U2FValidator.test.ts (95%) rename test/{ => unit}/client/totp-register/totp-register.test.ts (80%) rename test/{ => unit}/server/AuthenticationRegulator.test.ts (89%) rename test/{ => unit}/server/ConfigurationAdapter.test.ts (95%) rename test/{ => unit}/server/DataPersistence.test.ts (95%) rename test/{ => unit}/server/IdentityCheckMiddleware.test.ts (96%) rename test/{ => unit}/server/LdapClient.test.ts (98%) rename test/{ => unit}/server/ServerConfiguration.test.ts (88%) rename test/{ => unit}/server/SessionConfigurationBuilder.test.ts (94%) rename test/{ => unit}/server/TOTPValidator.test.ts (91%) rename test/{ => unit}/server/UserDataStore.test.ts (97%) rename test/{ => unit}/server/access_control/AccessController.test.ts (92%) rename test/{ => unit}/server/access_control/PatternBuilder.test.ts (96%) rename test/{ => unit}/server/mocks/AccessController.ts (100%) rename test/{ => unit}/server/mocks/AuthenticationRegulator.ts (100%) rename test/{ => unit}/server/mocks/IdentityValidator.ts (87%) rename test/{ => unit}/server/mocks/LdapClient.ts (100%) rename test/{ => unit}/server/mocks/Notifier.ts (100%) rename test/{ => unit}/server/mocks/ServerVariablesMock.ts (89%) rename test/{ => unit}/server/mocks/TOTPValidator.ts (100%) rename test/{ => unit}/server/mocks/UserDataStore.ts (100%) rename test/{ => unit}/server/mocks/express.ts (100%) rename test/{ => unit}/server/mocks/ldapjs.ts (100%) rename test/{ => unit}/server/mocks/nodemailer.ts (100%) rename test/{ => unit}/server/mocks/speakeasy.ts (100%) rename test/{ => unit}/server/mocks/u2f.ts (100%) rename test/{ => unit}/server/notifiers/FileSystemNotifier.test.ts (91%) rename test/{ => unit}/server/notifiers/GMailNotifier.test.ts (93%) rename test/{ => unit}/server/notifiers/NotifierFactory.test.ts (76%) rename test/{ => unit}/server/requests.ts (98%) rename test/{ => unit}/server/routes/firstfactor/post.test.ts (94%) rename test/{ => unit}/server/routes/password-reset/identity/PasswordResetHandler.test.ts (94%) rename test/{ => unit}/server/routes/password-reset/post.test.ts (93%) rename test/{ => unit}/server/routes/secondfactor/totp/register/RegistrationHandler.test.ts (91%) rename test/{ => unit}/server/routes/secondfactor/totp/sign/post.test.ts (91%) rename test/{ => unit}/server/routes/secondfactor/u2f/identity/RegistrationHandler.test.ts (91%) rename test/{ => unit}/server/routes/secondfactor/u2f/register/post.test.ts (95%) rename test/{ => unit}/server/routes/secondfactor/u2f/register_request/get.test.ts (93%) rename test/{ => unit}/server/routes/secondfactor/u2f/sign/post.test.ts (94%) rename test/{ => unit}/server/routes/secondfactor/u2f/sign_request/get.test.ts (88%) rename test/{ => unit}/server/routes/verify/get.test.ts (95%) rename test/{ => unit}/server/server/PrivatePages.ts (94%) rename test/{ => unit}/server/server/PublicPages.ts (92%) rename test/{ => unit}/server/server/Server.test.ts (96%) rename test/{ => unit}/server/user_data_store/authentication_audit.test.ts (96%) rename test/{ => unit}/server/user_data_store/totp_secret.test.ts (96%) diff --git a/Gruntfile.js b/Gruntfile.js index f3f43c1e..695b5944 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -14,12 +14,16 @@ module.exports = function (grunt) { }, "test": { 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": { cmd: "./node_modules/.bin/mocha", 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": { cmd: "docker", args: ['build', '-t', 'clems4ever/authelia', '.'] diff --git a/README.md b/README.md index 14108ddf..26cf1ab2 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ Deploy **Authelia** example with the following command: npm install --only=dev ./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 [https://home.test.local:8080/](https://home.test.local:8080/). diff --git a/scripts/dc-test.sh b/scripts/dc-test.sh deleted file mode 100755 index 533f363c..00000000 --- a/scripts/dc-test.sh +++ /dev/null @@ -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 $* diff --git a/scripts/deploy-example.sh b/scripts/deploy-example.sh deleted file mode 100755 index 006747a4..00000000 --- a/scripts/deploy-example.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -./scripts/dc-example.sh build -./scripts/dc-example.sh up -d diff --git a/scripts/check-services.sh b/scripts/example/check-services.sh similarity index 100% rename from scripts/check-services.sh rename to scripts/example/check-services.sh diff --git a/scripts/dc-example.sh b/scripts/example/dc-example.sh similarity index 100% rename from scripts/dc-example.sh rename to scripts/example/dc-example.sh diff --git a/scripts/example/deploy-example.sh b/scripts/example/deploy-example.sh new file mode 100755 index 00000000..e804face --- /dev/null +++ b/scripts/example/deploy-example.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +DC_SCRIPT=./scripts/example/dc-example.sh + +$DC_SCRIPT build +$DC_SCRIPT up -d diff --git a/scripts/example/undeploy-example.sh b/scripts/example/undeploy-example.sh new file mode 100755 index 00000000..0c3a6f7b --- /dev/null +++ b/scripts/example/undeploy-example.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +DC_SCRIPT=./scripts/example/dc-example.sh + +$DC_SCRIPT down diff --git a/scripts/integration-tests.sh b/scripts/integration-tests.sh index bb644a10..681f5858 100755 --- a/scripts/integration-tests.sh +++ b/scripts/integration-tests.sh @@ -1,35 +1,54 @@ #!/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 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" cat example/nginx/nginx.conf | sed 's/listen 443 ssl/listen 8080 ssl/g' | dd of="test/integration/nginx.conf" echo "Build services images..." -./scripts/dc-example.sh build +$DC_SCRIPT build echo "Start services..." -./scripts/dc-example.sh up -d redis openldap -sleep 2 -./scripts/dc-example.sh up -d authelia nginx nginx-tests -sleep 3 +run_services docker ps -a echo "Display services logs..." -./scripts/dc-example.sh logs redis -./scripts/dc-example.sh logs openldap -./scripts/dc-example.sh logs nginx -./scripts/dc-example.sh logs nginx-tests -./scripts/dc-example.sh logs authelia +$DC_SCRIPT logs redis +$DC_SCRIPT logs openldap +$DC_SCRIPT logs nginx +$DC_SCRIPT logs nginx-tests +$DC_SCRIPT logs authelia echo "Check number of services" -./scripts/check-services.sh +./scripts/example/check-services.sh echo "Run integration tests..." -./scripts/dc-example.sh run --rm integration-tests +$DC_SCRIPT run --rm integration-tests 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 + diff --git a/scripts/undeploy-example.sh b/scripts/undeploy-example.sh deleted file mode 100755 index 5040b84f..00000000 --- a/scripts/undeploy-example.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -./scripts/dc-example.sh down diff --git a/test/integration/main.ts b/test/integration/main.ts index 6e7c10f7..0f6db7d5 100644 --- a/test/integration/main.ts +++ b/test/integration/main.ts @@ -31,7 +31,7 @@ const redisOptions = { }; -describe("test example environment", function () { +describe("integration tests", function () { let redisClient: Redis.RedisClient; before(function () { diff --git a/test/system/main.ts b/test/system/main.ts new file mode 100644 index 00000000..7e7591b9 --- /dev/null +++ b/test/system/main.ts @@ -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); + }); + }); +}); \ No newline at end of file diff --git a/test/client/firstfactor/FirstFactorValidator.test.ts b/test/unit/client/firstfactor/FirstFactorValidator.test.ts similarity index 94% rename from test/client/firstfactor/FirstFactorValidator.test.ts rename to test/unit/client/firstfactor/FirstFactorValidator.test.ts index 717f1060..7ac115d0 100644 --- a/test/client/firstfactor/FirstFactorValidator.test.ts +++ b/test/unit/client/firstfactor/FirstFactorValidator.test.ts @@ -1,5 +1,5 @@ -import FirstFactorValidator = require("../../../src/client/firstfactor/FirstFactorValidator"); +import FirstFactorValidator = require("../../../../src/client/firstfactor/FirstFactorValidator"); import JQueryMock = require("../mocks/jquery"); import BluebirdPromise = require("bluebird"); import Assert = require("assert"); diff --git a/test/client/firstfactor/login.test.ts b/test/unit/client/firstfactor/login.test.ts similarity index 93% rename from test/client/firstfactor/login.test.ts rename to test/unit/client/firstfactor/login.test.ts index 50e7307f..daf9688c 100644 --- a/test/client/firstfactor/login.test.ts +++ b/test/unit/client/firstfactor/login.test.ts @@ -1,9 +1,9 @@ -import Endpoints = require("../../../src/server/endpoints"); +import Endpoints = require("../../../../src/server/endpoints"); import BluebirdPromise = require("bluebird"); -import UISelectors = require("../../../src/client/firstfactor/UISelectors"); -import firstfactor from "../../../src/client/firstfactor/index"; +import UISelectors = require("../../../../src/client/firstfactor/UISelectors"); +import firstfactor from "../../../../src/client/firstfactor/index"; import JQueryMock = require("../mocks/jquery"); import Assert = require("assert"); import sinon = require("sinon"); diff --git a/test/client/mocks/jquery.ts b/test/unit/client/mocks/jquery.ts similarity index 100% rename from test/client/mocks/jquery.ts rename to test/unit/client/mocks/jquery.ts diff --git a/test/client/mocks/u2f-api.ts b/test/unit/client/mocks/u2f-api.ts similarity index 100% rename from test/client/mocks/u2f-api.ts rename to test/unit/client/mocks/u2f-api.ts diff --git a/test/client/secondfactor/TOTPValidator.test.ts b/test/unit/client/secondfactor/TOTPValidator.test.ts similarity index 94% rename from test/client/secondfactor/TOTPValidator.test.ts rename to test/unit/client/secondfactor/TOTPValidator.test.ts index dd10db8b..26024904 100644 --- a/test/client/secondfactor/TOTPValidator.test.ts +++ b/test/unit/client/secondfactor/TOTPValidator.test.ts @@ -1,5 +1,5 @@ -import TOTPValidator = require("../../../src/client/secondfactor/TOTPValidator"); +import TOTPValidator = require("../../../../src/client/secondfactor/TOTPValidator"); import JQueryMock = require("../mocks/jquery"); import BluebirdPromise = require("bluebird"); import Assert = require("assert"); diff --git a/test/client/secondfactor/U2FValidator.test.ts b/test/unit/client/secondfactor/U2FValidator.test.ts similarity index 95% rename from test/client/secondfactor/U2FValidator.test.ts rename to test/unit/client/secondfactor/U2FValidator.test.ts index feb08297..d9f72c32 100644 --- a/test/client/secondfactor/U2FValidator.test.ts +++ b/test/unit/client/secondfactor/U2FValidator.test.ts @@ -1,8 +1,8 @@ -import U2FValidator = require("../../../src/client/secondfactor/U2FValidator"); +import U2FValidator = require("../../../../src/client/secondfactor/U2FValidator"); import JQueryMock = require("../mocks/jquery"); 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 Assert = require("assert"); diff --git a/test/client/totp-register/totp-register.test.ts b/test/unit/client/totp-register/totp-register.test.ts similarity index 80% rename from test/client/totp-register/totp-register.test.ts rename to test/unit/client/totp-register/totp-register.test.ts index 0a445cc4..9d01ffe0 100644 --- a/test/client/totp-register/totp-register.test.ts +++ b/test/unit/client/totp-register/totp-register.test.ts @@ -2,8 +2,8 @@ import sinon = require("sinon"); import assert = require("assert"); -import UISelector = require("../../../src/client/totp-register/ui-selector"); -import TOTPRegister = require("../../../src/client/totp-register/totp-register"); +import UISelector = require("../../../../src/client/totp-register/ui-selector"); +import TOTPRegister = require("../../../../src/client/totp-register/totp-register"); describe("test totp-register", function() { let jqueryMock: any; diff --git a/test/server/AuthenticationRegulator.test.ts b/test/unit/server/AuthenticationRegulator.test.ts similarity index 89% rename from test/server/AuthenticationRegulator.test.ts rename to test/unit/server/AuthenticationRegulator.test.ts index 549ea054..9eee3439 100644 --- a/test/server/AuthenticationRegulator.test.ts +++ b/test/unit/server/AuthenticationRegulator.test.ts @@ -1,8 +1,8 @@ -import { AuthenticationRegulator } from "../../src/server/lib/AuthenticationRegulator"; -import UserDataStore from "../../src/server/lib/UserDataStore"; +import { AuthenticationRegulator } from "../../../src/server/lib/AuthenticationRegulator"; +import UserDataStore from "../../../src/server/lib/UserDataStore"; import MockDate = require("mockdate"); -import exceptions = require("../../src/server/lib/Exceptions"); +import exceptions = require("../../../src/server/lib/Exceptions"); import nedb = require("nedb"); describe("test authentication regulator", function() { diff --git a/test/server/ConfigurationAdapter.test.ts b/test/unit/server/ConfigurationAdapter.test.ts similarity index 95% rename from test/server/ConfigurationAdapter.test.ts rename to test/unit/server/ConfigurationAdapter.test.ts index 9c27f43a..c7f2b90a 100644 --- a/test/server/ConfigurationAdapter.test.ts +++ b/test/unit/server/ConfigurationAdapter.test.ts @@ -1,6 +1,6 @@ import * as Assert from "assert"; -import { UserConfiguration } from "../../src/types/Configuration"; -import ConfigurationAdapter from "../../src/server/lib/ConfigurationAdapter"; +import { UserConfiguration } from "../../../src/types/Configuration"; +import ConfigurationAdapter from "../../../src/server/lib/ConfigurationAdapter"; describe("test config adapter", function() { function build_yaml_config(): UserConfiguration { diff --git a/test/server/DataPersistence.test.ts b/test/unit/server/DataPersistence.test.ts similarity index 95% rename from test/server/DataPersistence.test.ts rename to test/unit/server/DataPersistence.test.ts index ae4d85ff..53928573 100644 --- a/test/server/DataPersistence.test.ts +++ b/test/unit/server/DataPersistence.test.ts @@ -2,9 +2,9 @@ import * as BluebirdPromise from "bluebird"; import * as request from "request"; -import Server from "../../src/server/lib/Server"; -import { UserConfiguration } from "../../src/types/Configuration"; -import { GlobalDependencies } from "../../src/types/Dependencies"; +import Server from "../../../src/server/lib/Server"; +import { UserConfiguration } from "../../../src/types/Configuration"; +import { GlobalDependencies } from "../../../src/types/Dependencies"; import * as tmp from "tmp"; import U2FMock = require("./mocks/u2f"); import { LdapjsClientMock } from "./mocks/ldapjs"; diff --git a/test/server/IdentityCheckMiddleware.test.ts b/test/unit/server/IdentityCheckMiddleware.test.ts similarity index 96% rename from test/server/IdentityCheckMiddleware.test.ts rename to test/unit/server/IdentityCheckMiddleware.test.ts index 12d40e83..5aa8d2f8 100644 --- a/test/server/IdentityCheckMiddleware.test.ts +++ b/test/unit/server/IdentityCheckMiddleware.test.ts @@ -1,8 +1,8 @@ import sinon = require("sinon"); -import IdentityValidator = require("../../src/server/lib/IdentityCheckMiddleware"); -import AuthenticationSession = require("../../src/server/lib/AuthenticationSession"); -import exceptions = require("../../src/server/lib/Exceptions"); +import IdentityValidator = require("../../../src/server/lib/IdentityCheckMiddleware"); +import AuthenticationSession = require("../../../src/server/lib/AuthenticationSession"); +import exceptions = require("../../../src/server/lib/Exceptions"); import assert = require("assert"); import winston = require("winston"); import Promise = require("bluebird"); diff --git a/test/server/LdapClient.test.ts b/test/unit/server/LdapClient.test.ts similarity index 98% rename from test/server/LdapClient.test.ts rename to test/unit/server/LdapClient.test.ts index 8d1abe94..729de3ac 100644 --- a/test/server/LdapClient.test.ts +++ b/test/unit/server/LdapClient.test.ts @@ -1,6 +1,6 @@ -import LdapClient = require("../../src/server/lib/LdapClient"); -import { LdapConfiguration } from "../../src/types/Configuration"; +import LdapClient = require("../../../src/server/lib/LdapClient"); +import { LdapConfiguration } from "../../../src/types/Configuration"; import sinon = require("sinon"); import BluebirdPromise = require("bluebird"); diff --git a/test/server/ServerConfiguration.test.ts b/test/unit/server/ServerConfiguration.test.ts similarity index 88% rename from test/server/ServerConfiguration.test.ts rename to test/unit/server/ServerConfiguration.test.ts index f9052bd9..5b1220d8 100644 --- a/test/server/ServerConfiguration.test.ts +++ b/test/unit/server/ServerConfiguration.test.ts @@ -9,9 +9,9 @@ import u2f = require("u2f"); import nodemailer = require("nodemailer"); import session = require("express-session"); -import { AppConfiguration, UserConfiguration } from "../../src/types/Configuration"; -import { GlobalDependencies, Nodemailer } from "../../src/types/Dependencies"; -import Server from "../../src/server/lib/Server"; +import { AppConfiguration, UserConfiguration } from "../../../src/types/Configuration"; +import { GlobalDependencies, Nodemailer } from "../../../src/types/Dependencies"; +import Server from "../../../src/server/lib/Server"; describe("test server configuration", function () { diff --git a/test/server/SessionConfigurationBuilder.test.ts b/test/unit/server/SessionConfigurationBuilder.test.ts similarity index 94% rename from test/server/SessionConfigurationBuilder.test.ts rename to test/unit/server/SessionConfigurationBuilder.test.ts index e6f94b23..97f87ef0 100644 --- a/test/server/SessionConfigurationBuilder.test.ts +++ b/test/unit/server/SessionConfigurationBuilder.test.ts @@ -1,6 +1,6 @@ -import SessionConfigurationBuilder from "../../src/server/lib/SessionConfigurationBuilder"; -import { AppConfiguration } from "../../src/types/Configuration"; -import { GlobalDependencies } from "../../src/types/Dependencies"; +import SessionConfigurationBuilder from "../../../src/server/lib/SessionConfigurationBuilder"; +import { AppConfiguration } from "../../../src/types/Configuration"; +import { GlobalDependencies } from "../../../src/types/Dependencies"; import ExpressSession = require("express-session"); import ConnectRedis = require("connect-redis"); import sinon = require("sinon"); diff --git a/test/server/TOTPValidator.test.ts b/test/unit/server/TOTPValidator.test.ts similarity index 91% rename from test/server/TOTPValidator.test.ts rename to test/unit/server/TOTPValidator.test.ts index e848e694..0ef3faf5 100644 --- a/test/server/TOTPValidator.test.ts +++ b/test/unit/server/TOTPValidator.test.ts @@ -1,5 +1,5 @@ -import { TOTPValidator } from "../../src/server/lib/TOTPValidator"; +import { TOTPValidator } from "../../../src/server/lib/TOTPValidator"; import sinon = require("sinon"); import Promise = require("bluebird"); import SpeakeasyMock = require("./mocks/speakeasy"); diff --git a/test/server/UserDataStore.test.ts b/test/unit/server/UserDataStore.test.ts similarity index 97% rename from test/server/UserDataStore.test.ts rename to test/unit/server/UserDataStore.test.ts index 8c7b8128..d482237a 100644 --- a/test/server/UserDataStore.test.ts +++ b/test/unit/server/UserDataStore.test.ts @@ -1,6 +1,6 @@ -import UserDataStore from "../../src/server/lib/UserDataStore"; -import { U2FRegistrationDocument, Options } from "../../src/server/lib/UserDataStore"; +import UserDataStore from "../../../src/server/lib/UserDataStore"; +import { U2FRegistrationDocument, Options } from "../../../src/server/lib/UserDataStore"; import nedb = require("nedb"); import assert = require("assert"); diff --git a/test/server/access_control/AccessController.test.ts b/test/unit/server/access_control/AccessController.test.ts similarity index 92% rename from test/server/access_control/AccessController.test.ts rename to test/unit/server/access_control/AccessController.test.ts index 5e5f5e3f..37ddb583 100644 --- a/test/server/access_control/AccessController.test.ts +++ b/test/unit/server/access_control/AccessController.test.ts @@ -1,8 +1,8 @@ import assert = require("assert"); import winston = require("winston"); -import { AccessController } from "../../../src/server/lib/access_control/AccessController"; -import { ACLConfiguration } from "../../../src/types/Configuration"; +import { AccessController } from "../../../../src/server/lib/access_control/AccessController"; +import { ACLConfiguration } from "../../../../src/types/Configuration"; describe("test access control manager", function () { let accessController: AccessController; diff --git a/test/server/access_control/PatternBuilder.test.ts b/test/unit/server/access_control/PatternBuilder.test.ts similarity index 96% rename from test/server/access_control/PatternBuilder.test.ts rename to test/unit/server/access_control/PatternBuilder.test.ts index 391919fb..82c3630b 100644 --- a/test/server/access_control/PatternBuilder.test.ts +++ b/test/unit/server/access_control/PatternBuilder.test.ts @@ -2,8 +2,8 @@ import assert = require("assert"); import winston = require("winston"); -import PatternBuilder from "../../../src/server/lib/access_control/PatternBuilder"; -import { ACLConfiguration } from "../../../src/types/Configuration"; +import PatternBuilder from "../../../../src/server/lib/access_control/PatternBuilder"; +import { ACLConfiguration } from "../../../../src/types/Configuration"; describe("test access control manager", function () { describe("test access control pattern builder when no configuration is provided", () => { diff --git a/test/server/mocks/AccessController.ts b/test/unit/server/mocks/AccessController.ts similarity index 100% rename from test/server/mocks/AccessController.ts rename to test/unit/server/mocks/AccessController.ts diff --git a/test/server/mocks/AuthenticationRegulator.ts b/test/unit/server/mocks/AuthenticationRegulator.ts similarity index 100% rename from test/server/mocks/AuthenticationRegulator.ts rename to test/unit/server/mocks/AuthenticationRegulator.ts diff --git a/test/server/mocks/IdentityValidator.ts b/test/unit/server/mocks/IdentityValidator.ts similarity index 87% rename from test/server/mocks/IdentityValidator.ts rename to test/unit/server/mocks/IdentityValidator.ts index bd8dcd7e..24898fc9 100644 --- a/test/server/mocks/IdentityValidator.ts +++ b/test/unit/server/mocks/IdentityValidator.ts @@ -1,9 +1,9 @@ import sinon = require("sinon"); -import { IdentityValidable } from "../../../src/server/lib/IdentityCheckMiddleware"; +import { IdentityValidable } from "../../../../src/server/lib/IdentityCheckMiddleware"; import express = require("express"); import BluebirdPromise = require("bluebird"); -import { Identity } from "../../../src/types/Identity"; +import { Identity } from "../../../../src/types/Identity"; export interface IdentityValidableMock { diff --git a/test/server/mocks/LdapClient.ts b/test/unit/server/mocks/LdapClient.ts similarity index 100% rename from test/server/mocks/LdapClient.ts rename to test/unit/server/mocks/LdapClient.ts diff --git a/test/server/mocks/Notifier.ts b/test/unit/server/mocks/Notifier.ts similarity index 100% rename from test/server/mocks/Notifier.ts rename to test/unit/server/mocks/Notifier.ts diff --git a/test/server/mocks/ServerVariablesMock.ts b/test/unit/server/mocks/ServerVariablesMock.ts similarity index 89% rename from test/server/mocks/ServerVariablesMock.ts rename to test/unit/server/mocks/ServerVariablesMock.ts index b5dda7da..d349e956 100644 --- a/test/server/mocks/ServerVariablesMock.ts +++ b/test/unit/server/mocks/ServerVariablesMock.ts @@ -1,6 +1,6 @@ import sinon = require("sinon"); 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 { logger: any; diff --git a/test/server/mocks/TOTPValidator.ts b/test/unit/server/mocks/TOTPValidator.ts similarity index 100% rename from test/server/mocks/TOTPValidator.ts rename to test/unit/server/mocks/TOTPValidator.ts diff --git a/test/server/mocks/UserDataStore.ts b/test/unit/server/mocks/UserDataStore.ts similarity index 100% rename from test/server/mocks/UserDataStore.ts rename to test/unit/server/mocks/UserDataStore.ts diff --git a/test/server/mocks/express.ts b/test/unit/server/mocks/express.ts similarity index 100% rename from test/server/mocks/express.ts rename to test/unit/server/mocks/express.ts diff --git a/test/server/mocks/ldapjs.ts b/test/unit/server/mocks/ldapjs.ts similarity index 100% rename from test/server/mocks/ldapjs.ts rename to test/unit/server/mocks/ldapjs.ts diff --git a/test/server/mocks/nodemailer.ts b/test/unit/server/mocks/nodemailer.ts similarity index 100% rename from test/server/mocks/nodemailer.ts rename to test/unit/server/mocks/nodemailer.ts diff --git a/test/server/mocks/speakeasy.ts b/test/unit/server/mocks/speakeasy.ts similarity index 100% rename from test/server/mocks/speakeasy.ts rename to test/unit/server/mocks/speakeasy.ts diff --git a/test/server/mocks/u2f.ts b/test/unit/server/mocks/u2f.ts similarity index 100% rename from test/server/mocks/u2f.ts rename to test/unit/server/mocks/u2f.ts diff --git a/test/server/notifiers/FileSystemNotifier.test.ts b/test/unit/server/notifiers/FileSystemNotifier.test.ts similarity index 91% rename from test/server/notifiers/FileSystemNotifier.test.ts rename to test/unit/server/notifiers/FileSystemNotifier.test.ts index add77dcc..eecab657 100644 --- a/test/server/notifiers/FileSystemNotifier.test.ts +++ b/test/unit/server/notifiers/FileSystemNotifier.test.ts @@ -1,7 +1,7 @@ import * as sinon from "sinon"; 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 fs from "fs"; import BluebirdPromise = require("bluebird"); diff --git a/test/server/notifiers/GMailNotifier.test.ts b/test/unit/server/notifiers/GMailNotifier.test.ts similarity index 93% rename from test/server/notifiers/GMailNotifier.test.ts rename to test/unit/server/notifiers/GMailNotifier.test.ts index c9deb8fe..08b6a112 100644 --- a/test/server/notifiers/GMailNotifier.test.ts +++ b/test/unit/server/notifiers/GMailNotifier.test.ts @@ -3,7 +3,7 @@ import * as assert from "assert"; import BluebirdPromise = require("bluebird"); 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 () { diff --git a/test/server/notifiers/NotifierFactory.test.ts b/test/unit/server/notifiers/NotifierFactory.test.ts similarity index 76% rename from test/server/notifiers/NotifierFactory.test.ts rename to test/unit/server/notifiers/NotifierFactory.test.ts index bf6c79a5..8b4d8674 100644 --- a/test/server/notifiers/NotifierFactory.test.ts +++ b/test/unit/server/notifiers/NotifierFactory.test.ts @@ -3,9 +3,9 @@ import * as sinon from "sinon"; import * as BluebirdPromise from "bluebird"; import * as assert from "assert"; -import { NotifierFactory } from "../../../src/server/lib/notifiers/NotifierFactory"; -import { GMailNotifier } from "../../../src/server/lib/notifiers/GMailNotifier"; -import { FileSystemNotifier } from "../../../src/server/lib/notifiers/FileSystemNotifier"; +import { NotifierFactory } from "../../../../src/server/lib/notifiers/NotifierFactory"; +import { GMailNotifier } from "../../../../src/server/lib/notifiers/GMailNotifier"; +import { FileSystemNotifier } from "../../../../src/server/lib/notifiers/FileSystemNotifier"; import NodemailerMock = require("../mocks/nodemailer"); diff --git a/test/server/requests.ts b/test/unit/server/requests.ts similarity index 98% rename from test/server/requests.ts rename to test/unit/server/requests.ts index a7837436..557cf909 100644 --- a/test/server/requests.ts +++ b/test/unit/server/requests.ts @@ -4,7 +4,7 @@ import request = require("request"); import assert = require("assert"); import express = require("express"); import nodemailer = require("nodemailer"); -import Endpoints = require("../../src/server/endpoints"); +import Endpoints = require("../../../src/server/endpoints"); import NodemailerMock = require("./mocks/nodemailer"); diff --git a/test/server/routes/firstfactor/post.test.ts b/test/unit/server/routes/firstfactor/post.test.ts similarity index 94% rename from test/server/routes/firstfactor/post.test.ts rename to test/unit/server/routes/firstfactor/post.test.ts index 25baab59..b2bcfff2 100644 --- a/test/server/routes/firstfactor/post.test.ts +++ b/test/unit/server/routes/firstfactor/post.test.ts @@ -4,10 +4,10 @@ import BluebirdPromise = require("bluebird"); import assert = require("assert"); import winston = require("winston"); -import FirstFactorPost = require("../../../../src/server/lib/routes/firstfactor/post"); -import exceptions = require("../../../../src/server/lib/Exceptions"); -import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession"); -import Endpoints = require("../../../../src/server/endpoints"); +import FirstFactorPost = require("../../../../../src/server/lib/routes/firstfactor/post"); +import exceptions = require("../../../../../src/server/lib/Exceptions"); +import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession"); +import Endpoints = require("../../../../../src/server/endpoints"); import AuthenticationRegulatorMock = require("../../mocks/AuthenticationRegulator"); import AccessControllerMock = require("../../mocks/AccessController"); diff --git a/test/server/routes/password-reset/identity/PasswordResetHandler.test.ts b/test/unit/server/routes/password-reset/identity/PasswordResetHandler.test.ts similarity index 94% rename from test/server/routes/password-reset/identity/PasswordResetHandler.test.ts rename to test/unit/server/routes/password-reset/identity/PasswordResetHandler.test.ts index f69edf5b..f19e77ae 100644 --- a/test/server/routes/password-reset/identity/PasswordResetHandler.test.ts +++ b/test/unit/server/routes/password-reset/identity/PasswordResetHandler.test.ts @@ -1,6 +1,6 @@ -import PasswordResetHandler from "../../../../../src/server/lib/routes/password-reset/identity/PasswordResetHandler"; -import LdapClient = require("../../../../../src/server/lib/LdapClient"); +import PasswordResetHandler from "../../../../../../src/server/lib/routes/password-reset/identity/PasswordResetHandler"; +import LdapClient = require("../../../../../../src/server/lib/LdapClient"); import sinon = require("sinon"); import winston = require("winston"); import assert = require("assert"); diff --git a/test/server/routes/password-reset/post.test.ts b/test/unit/server/routes/password-reset/post.test.ts similarity index 93% rename from test/server/routes/password-reset/post.test.ts rename to test/unit/server/routes/password-reset/post.test.ts index 9362de8a..1ef436e8 100644 --- a/test/server/routes/password-reset/post.test.ts +++ b/test/unit/server/routes/password-reset/post.test.ts @@ -1,7 +1,7 @@ -import PasswordResetFormPost = require("../../../../src/server/lib/routes/password-reset/form/post"); -import LdapClient = require("../../../../src/server/lib/LdapClient"); -import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession"); +import PasswordResetFormPost = require("../../../../../src/server/lib/routes/password-reset/form/post"); +import LdapClient = require("../../../../../src/server/lib/LdapClient"); +import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession"); import sinon = require("sinon"); import winston = require("winston"); import assert = require("assert"); diff --git a/test/server/routes/secondfactor/totp/register/RegistrationHandler.test.ts b/test/unit/server/routes/secondfactor/totp/register/RegistrationHandler.test.ts similarity index 91% rename from test/server/routes/secondfactor/totp/register/RegistrationHandler.test.ts rename to test/unit/server/routes/secondfactor/totp/register/RegistrationHandler.test.ts index e3f2cb89..2cb0be33 100644 --- a/test/server/routes/secondfactor/totp/register/RegistrationHandler.test.ts +++ b/test/unit/server/routes/secondfactor/totp/register/RegistrationHandler.test.ts @@ -1,8 +1,8 @@ import sinon = require("sinon"); import winston = require("winston"); -import RegistrationHandler from "../../../../../../src/server/lib/routes/secondfactor/totp/identity/RegistrationHandler"; -import { Identity } from "../../../../../../src/types/Identity"; -import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); +import RegistrationHandler from "../../../../../../../src/server/lib/routes/secondfactor/totp/identity/RegistrationHandler"; +import { Identity } from "../../../../../../../src/types/Identity"; +import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession"); import assert = require("assert"); import BluebirdPromise = require("bluebird"); diff --git a/test/server/routes/secondfactor/totp/sign/post.test.ts b/test/unit/server/routes/secondfactor/totp/sign/post.test.ts similarity index 91% rename from test/server/routes/secondfactor/totp/sign/post.test.ts rename to test/unit/server/routes/secondfactor/totp/sign/post.test.ts index d1259535..1a1bd998 100644 --- a/test/server/routes/secondfactor/totp/sign/post.test.ts +++ b/test/unit/server/routes/secondfactor/totp/sign/post.test.ts @@ -4,9 +4,9 @@ import sinon = require("sinon"); import assert = require("assert"); import winston = require("winston"); -import exceptions = require("../../../../../../src/server/lib/Exceptions"); -import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); -import SignPost = require("../../../../../../src/server/lib/routes/secondfactor/totp/sign/post"); +import exceptions = require("../../../../../../../src/server/lib/Exceptions"); +import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession"); +import SignPost = require("../../../../../../../src/server/lib/routes/secondfactor/totp/sign/post"); import ExpressMock = require("../../../../mocks/express"); import UserDataStoreMock = require("../../../../mocks/UserDataStore"); diff --git a/test/server/routes/secondfactor/u2f/identity/RegistrationHandler.test.ts b/test/unit/server/routes/secondfactor/u2f/identity/RegistrationHandler.test.ts similarity index 91% rename from test/server/routes/secondfactor/u2f/identity/RegistrationHandler.test.ts rename to test/unit/server/routes/secondfactor/u2f/identity/RegistrationHandler.test.ts index ba0db349..2126cae5 100644 --- a/test/server/routes/secondfactor/u2f/identity/RegistrationHandler.test.ts +++ b/test/unit/server/routes/secondfactor/u2f/identity/RegistrationHandler.test.ts @@ -3,9 +3,9 @@ import winston = require("winston"); import assert = require("assert"); import BluebirdPromise = require("bluebird"); -import { Identity } from "../../../../../../src/types/Identity"; -import RegistrationHandler from "../../../../../../src/server/lib/routes/secondfactor/u2f/identity/RegistrationHandler"; -import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); +import { Identity } from "../../../../../../../src/types/Identity"; +import RegistrationHandler from "../../../../../../../src/server/lib/routes/secondfactor/u2f/identity/RegistrationHandler"; +import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession"); import ExpressMock = require("../../../../mocks/express"); import UserDataStoreMock = require("../../../../mocks/UserDataStore"); diff --git a/test/server/routes/secondfactor/u2f/register/post.test.ts b/test/unit/server/routes/secondfactor/u2f/register/post.test.ts similarity index 95% rename from test/server/routes/secondfactor/u2f/register/post.test.ts rename to test/unit/server/routes/secondfactor/u2f/register/post.test.ts index a1d2f778..21a80353 100644 --- a/test/server/routes/secondfactor/u2f/register/post.test.ts +++ b/test/unit/server/routes/secondfactor/u2f/register/post.test.ts @@ -2,8 +2,8 @@ import sinon = require("sinon"); import BluebirdPromise = require("bluebird"); import assert = require("assert"); -import U2FRegisterPost = require("../../../../../../src/server/lib/routes/secondfactor/u2f/register/post"); -import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); +import U2FRegisterPost = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/register/post"); +import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession"); import winston = require("winston"); import ExpressMock = require("../../../../mocks/express"); diff --git a/test/server/routes/secondfactor/u2f/register_request/get.test.ts b/test/unit/server/routes/secondfactor/u2f/register_request/get.test.ts similarity index 93% rename from test/server/routes/secondfactor/u2f/register_request/get.test.ts rename to test/unit/server/routes/secondfactor/u2f/register_request/get.test.ts index 1f5405a6..55c2d74a 100644 --- a/test/server/routes/secondfactor/u2f/register_request/get.test.ts +++ b/test/unit/server/routes/secondfactor/u2f/register_request/get.test.ts @@ -2,8 +2,8 @@ import sinon = require("sinon"); import BluebirdPromise = require("bluebird"); import assert = require("assert"); -import U2FRegisterRequestGet = require("../../../../../../src/server/lib/routes/secondfactor/u2f/register_request/get"); -import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); +import U2FRegisterRequestGet = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/register_request/get"); +import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession"); import winston = require("winston"); import ExpressMock = require("../../../../mocks/express"); diff --git a/test/server/routes/secondfactor/u2f/sign/post.test.ts b/test/unit/server/routes/secondfactor/u2f/sign/post.test.ts similarity index 94% rename from test/server/routes/secondfactor/u2f/sign/post.test.ts rename to test/unit/server/routes/secondfactor/u2f/sign/post.test.ts index 0308dfec..f9d24386 100644 --- a/test/server/routes/secondfactor/u2f/sign/post.test.ts +++ b/test/unit/server/routes/secondfactor/u2f/sign/post.test.ts @@ -2,8 +2,8 @@ import sinon = require("sinon"); import BluebirdPromise = require("bluebird"); import assert = require("assert"); -import U2FSignPost = require("../../../../../../src/server/lib/routes/secondfactor/u2f/sign/post"); -import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); +import U2FSignPost = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/sign/post"); +import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession"); import winston = require("winston"); import ExpressMock = require("../../../../mocks/express"); diff --git a/test/server/routes/secondfactor/u2f/sign_request/get.test.ts b/test/unit/server/routes/secondfactor/u2f/sign_request/get.test.ts similarity index 88% rename from test/server/routes/secondfactor/u2f/sign_request/get.test.ts rename to test/unit/server/routes/secondfactor/u2f/sign_request/get.test.ts index 3ffc5dbb..365f4467 100644 --- a/test/server/routes/secondfactor/u2f/sign_request/get.test.ts +++ b/test/unit/server/routes/secondfactor/u2f/sign_request/get.test.ts @@ -2,8 +2,8 @@ import sinon = require("sinon"); import BluebirdPromise = require("bluebird"); import assert = require("assert"); -import U2FSignRequestGet = require("../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/get"); -import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession"); +import U2FSignRequestGet = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/get"); +import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession"); import winston = require("winston"); import ExpressMock = require("../../../../mocks/express"); @@ -12,7 +12,7 @@ import ServerVariablesMock = require("../../../../mocks/ServerVariablesMock"); import U2FMock = require("../../../../mocks/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 () { let req: ExpressMock.RequestMock; diff --git a/test/server/routes/verify/get.test.ts b/test/unit/server/routes/verify/get.test.ts similarity index 95% rename from test/server/routes/verify/get.test.ts rename to test/unit/server/routes/verify/get.test.ts index 3f93f0a3..0981a6c3 100644 --- a/test/server/routes/verify/get.test.ts +++ b/test/unit/server/routes/verify/get.test.ts @@ -1,7 +1,7 @@ import assert = require("assert"); -import VerifyGet = require("../../../../src/server/lib/routes/verify/get"); -import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession"); +import VerifyGet = require("../../../../../src/server/lib/routes/verify/get"); +import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession"); import sinon = require("sinon"); import winston = require("winston"); diff --git a/test/server/server/PrivatePages.ts b/test/unit/server/server/PrivatePages.ts similarity index 94% rename from test/server/server/PrivatePages.ts rename to test/unit/server/server/PrivatePages.ts index dcc690ab..5e3d88c0 100644 --- a/test/server/server/PrivatePages.ts +++ b/test/unit/server/server/PrivatePages.ts @@ -1,15 +1,15 @@ -import Server from "../../../src/server/lib/Server"; -import LdapClient = require("../../../src/server/lib/LdapClient"); +import Server from "../../../../src/server/lib/Server"; +import LdapClient = require("../../../../src/server/lib/LdapClient"); import BluebirdPromise = require("bluebird"); import speakeasy = require("speakeasy"); import request = require("request"); import nedb = require("nedb"); -import { GlobalDependencies } from "../../../src/types/Dependencies"; -import { TOTPSecret } from "../../../src/types/TOTPSecret"; +import { GlobalDependencies } from "../../../../src/types/Dependencies"; +import { TOTPSecret } from "../../../../src/types/TOTPSecret"; import U2FMock = require("./../mocks/u2f"); -import Endpoints = require("../../../src/server/endpoints"); +import Endpoints = require("../../../../src/server/endpoints"); import Requests = require("../requests"); import Assert = require("assert"); import Sinon = require("sinon"); diff --git a/test/server/server/PublicPages.ts b/test/unit/server/server/PublicPages.ts similarity index 92% rename from test/server/server/PublicPages.ts rename to test/unit/server/server/PublicPages.ts index 5d8fcec3..b6b5ccae 100644 --- a/test/server/server/PublicPages.ts +++ b/test/unit/server/server/PublicPages.ts @@ -1,15 +1,15 @@ -import Server from "../../../src/server/lib/Server"; -import LdapClient = require("../../../src/server/lib/LdapClient"); +import Server from "../../../../src/server/lib/Server"; +import LdapClient = require("../../../../src/server/lib/LdapClient"); import BluebirdPromise = require("bluebird"); import speakeasy = require("speakeasy"); import Request = require("request"); import nedb = require("nedb"); -import { GlobalDependencies } from "../../../src/types/Dependencies"; -import { TOTPSecret } from "../../../src/types/TOTPSecret"; +import { GlobalDependencies } from "../../../../src/types/Dependencies"; +import { TOTPSecret } from "../../../../src/types/TOTPSecret"; import U2FMock = require("./../mocks/u2f"); -import Endpoints = require("../../../src/server/endpoints"); +import Endpoints = require("../../../../src/server/endpoints"); import Requests = require("../requests"); import Assert = require("assert"); import Sinon = require("sinon"); diff --git a/test/server/server/Server.test.ts b/test/unit/server/server/Server.test.ts similarity index 96% rename from test/server/server/Server.test.ts rename to test/unit/server/server/Server.test.ts index b7396aa0..b3a7969c 100644 --- a/test/server/server/Server.test.ts +++ b/test/unit/server/server/Server.test.ts @@ -1,17 +1,17 @@ -import Server from "../../../src/server/lib/Server"; -import LdapClient = require("../../../src/server/lib/LdapClient"); +import Server from "../../../../src/server/lib/Server"; +import LdapClient = require("../../../../src/server/lib/LdapClient"); import { LdapjsClientMock } from "./../mocks/ldapjs"; import BluebirdPromise = require("bluebird"); import speakeasy = require("speakeasy"); import request = require("request"); import nedb = require("nedb"); -import { GlobalDependencies } from "../../../src/types/Dependencies"; -import { TOTPSecret } from "../../../src/types/TOTPSecret"; +import { GlobalDependencies } from "../../../../src/types/Dependencies"; +import { TOTPSecret } from "../../../../src/types/TOTPSecret"; import U2FMock = require("./../mocks/u2f"); -import Endpoints = require("../../../src/server/endpoints"); +import Endpoints = require("../../../../src/server/endpoints"); import Requests = require("../requests"); import Assert = require("assert"); import Sinon = require("sinon"); diff --git a/test/server/user_data_store/authentication_audit.test.ts b/test/unit/server/user_data_store/authentication_audit.test.ts similarity index 96% rename from test/server/user_data_store/authentication_audit.test.ts rename to test/unit/server/user_data_store/authentication_audit.test.ts index c0037fd0..5d1b824f 100644 --- a/test/server/user_data_store/authentication_audit.test.ts +++ b/test/unit/server/user_data_store/authentication_audit.test.ts @@ -3,7 +3,7 @@ import * as assert from "assert"; import * as Promise from "bluebird"; import * as sinon from "sinon"; import * as MockDate from "mockdate"; -import UserDataStore from "../../../src/server/lib/UserDataStore"; +import UserDataStore from "../../../../src/server/lib/UserDataStore"; import nedb = require("nedb"); describe("test user data store", function() { diff --git a/test/server/user_data_store/totp_secret.test.ts b/test/unit/server/user_data_store/totp_secret.test.ts similarity index 96% rename from test/server/user_data_store/totp_secret.test.ts rename to test/unit/server/user_data_store/totp_secret.test.ts index 08adcf6d..4a5b3922 100644 --- a/test/server/user_data_store/totp_secret.test.ts +++ b/test/unit/server/user_data_store/totp_secret.test.ts @@ -3,7 +3,7 @@ import * as assert from "assert"; import * as Promise from "bluebird"; import * as sinon from "sinon"; import * as MockDate from "mockdate"; -import UserDataStore from "../../../src/server/lib/UserDataStore"; +import UserDataStore from "../../../../src/server/lib/UserDataStore"; import nedb = require("nedb"); describe("test user data store", function() {