diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2016-11-22 00:50:57 +0100 |
---|---|---|
committer | Joram Wilander <jwawilander@gmail.com> | 2016-11-21 18:50:57 -0500 |
commit | d57ab7a81e295c0f1a731f1f4f5fa04d5cba398b (patch) | |
tree | 92c3505680dbecce1bc933d1257194fd0b6b6790 /webapp | |
parent | 82352e63633f95d546fc2d4b9f768a62cb4b6d58 (diff) | |
download | chat-d57ab7a81e295c0f1a731f1f4f5fa04d5cba398b.tar.gz chat-d57ab7a81e295c0f1a731f1f4f5fa04d5cba398b.tar.bz2 chat-d57ab7a81e295c0f1a731f1f4f5fa04d5cba398b.zip |
PLT-3762 - Add API call to get a user by their username (#4611)
* PLT-3762 - Add API call to get a user by their username
* fix lint
* update rote
* update per code review
* update per code review
* remove first/last name is not used in this test
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/client/client.jsx | 9 | ||||
-rw-r--r-- | webapp/tests/client_user.test.jsx | 15 |
2 files changed, 24 insertions, 0 deletions
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx index 538e82a72..092c2da4a 100644 --- a/webapp/client/client.jsx +++ b/webapp/client/client.jsx @@ -921,6 +921,15 @@ export default class Client { end(this.handleResponse.bind(this, 'getUser', success, error)); } + getByUsername(userName, success, error) { + request. + get(`${this.getUsersRoute()}/name/${userName}`). + set(this.defaultHeaders). + type('application/json'). + accept('application/json'). + end(this.handleResponse.bind(this, 'getByUsername', success, error)); + } + login(loginId, password, mfaToken, success, error) { this.doLogin({login_id: loginId, password, token: mfaToken}, success, error); diff --git a/webapp/tests/client_user.test.jsx b/webapp/tests/client_user.test.jsx index 5e70c5c3e..2e5b80dd7 100644 --- a/webapp/tests/client_user.test.jsx +++ b/webapp/tests/client_user.test.jsx @@ -36,6 +36,21 @@ describe('Client.User', function() { }); }); + it('getByUsername', function(done) { + TestHelper.initBasic(() => { + TestHelper.basicClient().getByUsername( + TestHelper.basicUser().username, + function(data) { + assert.equal(data.username, TestHelper.basicUser().username); + done(); + }, + function(err) { + done(new Error(err.message)); + } + ); + }); + }); + it('getInitialLoad', function(done) { TestHelper.initBasic(() => { TestHelper.basicClient().getInitialLoad( |