Skip to content

Commit 5789c9e

Browse files
committed
getUser renamed to fetchUser
1 parent 56f06e6 commit 5789c9e

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/security/kuzzleSecurity.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,23 +423,23 @@ Security.prototype.profile = function(id, content) {
423423
* @param {object|responseCallback} [options] - (optional) arguments
424424
* @param {responseCallback} cb - returns Kuzzle's response
425425
*/
426-
Security.prototype.getUser = function (id, options, cb) {
426+
Security.prototype.fetchUser = function (id, options, cb) {
427427
var
428428
data = {_id: id},
429429
self = this;
430430

431431
if (!id || typeof id !== 'string') {
432-
throw new Error('Id parameter is mandatory for getUser function');
432+
throw new Error('Id parameter is mandatory for fetchUser function');
433433
}
434434

435435
if (!cb && typeof options === 'function') {
436436
cb = options;
437437
options = null;
438438
}
439439

440-
self.kuzzle.callbackRequired('Security.getUser', cb);
440+
self.kuzzle.callbackRequired('Security.fetchUser', cb);
441441

442-
self.kuzzle.query(this.buildQueryArgs('getUser'), data, options, function (err, response) {
442+
self.kuzzle.query(this.buildQueryArgs('fetchUser'), data, options, function (err, response) {
443443
cb(err, err ? undefined : new User(self, response.result._id, response.result._source));
444444
});
445445
};

test/security/kuzzleSecurity/constructor.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe('kuzzleSecurity constructor', function () {
3232
should.exist(kuzzle.security.searchProfilesPromise);
3333
should.exist(kuzzle.security.deleteProfilePromise);
3434
should.exist(kuzzle.security.createUserPromise);
35-
should.exist(kuzzle.security.getUserPromise);
35+
should.exist(kuzzle.security.fetchUserPromise);
3636
should.exist(kuzzle.security.searchUsersPromise);
3737
should.exist(kuzzle.security.deleteUserPromise);
3838

test/security/kuzzleSecurity/userMethods.test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,21 @@ describe('Security user methods', function () {
4040
}
4141
};
4242

43-
describe('#getUser', function () {
43+
describe('#fetchUser', function () {
4444
beforeEach(function () {
4545
kuzzle = new Kuzzle('foo', {defaultIndex: 'bar'});
4646
kuzzle.query = queryStub;
4747
error = null;
4848
result = { result: {_id: 'foobar', _source: {profileIds: ['profile']}}};
4949
expectedQuery = {
50-
action: 'getUser',
50+
action: 'fetchUser',
5151
controller: 'security',
5252
_id: 'foobar'
5353
};
5454
});
5555

5656
it('should send the right query to Kuzzle', function (done) {
57-
should(kuzzle.security.getUser(result.result._id, function (err, res) {
57+
should(kuzzle.security.fetchUser(result.result._id, function (err, res) {
5858
should(err).be.null();
5959
should(res).be.instanceof(User);
6060

@@ -66,7 +66,7 @@ describe('Security user methods', function () {
6666
});
6767

6868
it('should send the right query to Kuzzle with id as profile', function (done) {
69-
should(kuzzle.security.getUser(result.result._id, function (err, res) {
69+
should(kuzzle.security.fetchUser(result.result._id, function (err, res) {
7070
should(err).be.null();
7171
should(res).be.instanceof(User);
7272

@@ -78,18 +78,18 @@ describe('Security user methods', function () {
7878
});
7979

8080
it('should raise an error if no callback is provided', function () {
81-
should(function () { kuzzle.security.getUser('test'); }).throw(Error);
81+
should(function () { kuzzle.security.fetchUser('test'); }).throw(Error);
8282
});
8383

8484
it('should throw an error when no id is provided', function () {
85-
should(function () { kuzzle.security.getUser(null, function () {}); }).throw(Error);
85+
should(function () { kuzzle.security.fetchUser(null, function () {}); }).throw(Error);
8686
});
8787

8888
it('should call the callback with an error if one occurs', function (done) {
8989
error = 'error';
9090
this.timeout(50);
9191

92-
kuzzle.security.getUser('foobar', function (err, res) {
92+
kuzzle.security.fetchUser('foobar', function (err, res) {
9393
should(err).be.exactly('error');
9494
should(res).be.undefined();
9595
done();

0 commit comments

Comments
 (0)