2017-09-03 03:38:26 +07:00
|
|
|
|
|
|
|
import BluebirdPromise = require("bluebird");
|
2017-10-07 05:09:42 +07:00
|
|
|
import { IClient, GroupsAndEmails } from "../../../src/lib/ldap/IClient";
|
2017-09-03 03:38:26 +07: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 18:46:19 +07:00
|
|
|
searchGroupsStub: Sinon.SinonStub;
|
2017-09-03 03:38:26 +07:00
|
|
|
modifyPasswordStub: Sinon.SinonStub;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
this.openStub = Sinon.stub();
|
|
|
|
this.closeStub = Sinon.stub();
|
|
|
|
this.searchUserDnStub = Sinon.stub();
|
|
|
|
this.searchEmailsStub = Sinon.stub();
|
2017-10-07 18:46:19 +07:00
|
|
|
this.searchGroupsStub = Sinon.stub();
|
2017-09-03 03:38:26 +07: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 18:46:19 +07:00
|
|
|
searchGroups(username: string): BluebirdPromise<string[]> {
|
|
|
|
return this.searchGroupsStub(username);
|
2017-09-03 03:38:26 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
modifyPassword(username: string, newPassword: string): BluebirdPromise<void> {
|
|
|
|
return this.modifyPasswordStub(username, newPassword);
|
|
|
|
}
|
|
|
|
}
|