authelia/server/test/mocks/IdentityValidator.ts

39 lines
1.1 KiB
TypeScript
Raw Normal View History

2017-05-22 03:45:54 +07:00
import sinon = require("sinon");
import { IdentityValidable } from "../../src/lib/IdentityCheckMiddleware";
2017-05-22 03:45:54 +07:00
import express = require("express");
import BluebirdPromise = require("bluebird");
import { Identity } from "../../types/Identity";
2017-05-22 03:45:54 +07:00
export interface IdentityValidableMock {
challenge: sinon.SinonStub;
preValidationInit: sinon.SinonStub;
preValidationResponse: sinon.SinonStub | sinon.SinonSpy;
postValidationInit: sinon.SinonStub;
postValidationResponse: sinon.SinonStub | sinon.SinonSpy;
2017-05-22 03:45:54 +07:00
mailSubject: sinon.SinonStub;
}
export function IdentityValidableMock() {
return {
challenge: sinon.stub(),
preValidationInit: sinon.stub(),
preValidationResponse: sinon.stub(),
postValidationInit: sinon.stub(),
postValidationResponse: sinon.stub(),
2017-05-22 03:45:54 +07:00
mailSubject: sinon.stub()
};
}
export interface IdentityValidatorMock {
consume_token: sinon.SinonStub;
issue_token: sinon.SinonStub;
}
export function IdentityValidatorMock() {
return {
consume_token: sinon.stub(),
issue_token: sinon.stub()
};
}