2017-09-02 20:38:26 +00:00
|
|
|
|
|
|
|
import BluebirdPromise = require("bluebird");
|
2017-10-06 22:09:42 +00:00
|
|
|
import { IClient, GroupsAndEmails } from "../../../src/lib/ldap/IClient";
|
2017-09-02 20:38:26 +00:00
|
|
|
import Sinon = require("sinon");
|
|
|
|
|
|
|
|
export class ClientStub implements IClient {
|
|
|
|
openStub: Sinon.SinonStub;
|
|
|
|
closeStub: Sinon.SinonStub;
|
|
|
|
searchUserDnStub: Sinon.SinonStub;
|
|
|
|
searchEmailsStub: Sinon.SinonStub;
|
2017-10-07 11:46:19 +00:00
|
|
|
searchGroupsStub: Sinon.SinonStub;
|
2017-09-02 20:38:26 +00:00
|
|
|
modifyPasswordStub: Sinon.SinonStub;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.openStub = Sinon.stub();
|
|
|
|
this.closeStub = Sinon.stub();
|
|
|
|
this.searchUserDnStub = Sinon.stub();
|
|
|
|
this.searchEmailsStub = Sinon.stub();
|
2017-10-07 11:46:19 +00:00
|
|
|
this.searchGroupsStub = Sinon.stub();
|
2017-09-02 20:38:26 +00:00
|
|
|
this.modifyPasswordStub = Sinon.stub();
|
|
|
|
}
|
|
|
|
|
|
|
|
open(): BluebirdPromise<void> {
|
|
|
|
return this.openStub();
|
|
|
|
}
|
|
|
|
|
|
|
|
close(): BluebirdPromise<void> {
|
|
|
|
return this.closeStub();
|
|
|
|
}
|
|
|
|
|
|
|
|
searchUserDn(username: string): BluebirdPromise<string> {
|
|
|
|
return this.searchUserDnStub(username);
|
|
|
|
}
|
|
|
|
|
|
|
|
searchEmails(username: string): BluebirdPromise<string[]> {
|
|
|
|
return this.searchEmailsStub(username);
|
|
|
|
}
|
|
|
|
|
2017-10-07 11:46:19 +00:00
|
|
|
searchGroups(username: string): BluebirdPromise<string[]> {
|
|
|
|
return this.searchGroupsStub(username);
|
2017-09-02 20:38:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
modifyPassword(username: string, newPassword: string): BluebirdPromise<void> {
|
|
|
|
return this.modifyPasswordStub(username, newPassword);
|
|
|
|
}
|
|
|
|
}
|