authelia/test/unit/server/mocks/ServerVariablesMock.ts

34 lines
946 B
TypeScript
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

import sinon = require("sinon");
import express = require("express");
import {  ServerVariables, VARIABLES_KEY }  from "../../../../src/server/lib/ServerVariables";
export interface ServerVariablesMock {
logger: any;
ldap: any;
totpValidator: any;
totpGenerator: any;
u2f: any;
userDataStore: any;
notifier: any;
regulator: any;
config: any;
accessController: any;
}
export function mock(app: express.Application): ServerVariablesMock {
const mocks: ServerVariablesMock = {
accessController: sinon.stub(),
config: sinon.stub(),
ldap: sinon.stub(),
logger: sinon.stub(),
notifier: sinon.stub(),
regulator: sinon.stub(),
totpGenerator: sinon.stub(),
totpValidator: sinon.stub(),
u2f: sinon.stub(),
userDataStore: sinon.stub()
};
app.get = sinon.stub().withArgs(VARIABLES_KEY).returns(mocks);
return mocks;
}