diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2016-12-08 16:21:43 +0100 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2016-12-08 10:21:43 -0500 |
commit | d402b1d010a56256f15bb482684c18b10ed4bcc5 (patch) | |
tree | 0f94813e07ced23c05b22dd302048698e88a7466 /webapp | |
parent | b57c9fec89f736de8622218d6dc779012a266a91 (diff) | |
download | chat-d402b1d010a56256f15bb482684c18b10ed4bcc5.tar.gz chat-d402b1d010a56256f15bb482684c18b10ed4bcc5.tar.bz2 chat-d402b1d010a56256f15bb482684c18b10ed4bcc5.zip |
Add API call to get a team by its name (#4690)
* Add API call to get a team by its name
* add tests for client side and update route regex
* remove action
* add check for permissions and create tests
Diffstat (limited to 'webapp')
-rw-r--r-- | webapp/client/client.jsx | 9 | ||||
-rw-r--r-- | webapp/tests/client_team.test.jsx | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/webapp/client/client.jsx b/webapp/client/client.jsx index dbc41f228..d8218490e 100644 --- a/webapp/client/client.jsx +++ b/webapp/client/client.jsx @@ -520,6 +520,15 @@ export default class Client { end(this.handleResponse.bind(this, 'findTeamByName', success, error)); } + getTeamByName(teamName, success, error) { + request. + get(`${this.getTeamsRoute()}/name/${teamName}`). + set(this.defaultHeaders). + type('application/json'). + accept('application/json'). + end(this.handleResponse.bind(this, 'getTeamByName', success, error)); + } + createTeam(team, success, error) { request. post(`${this.getTeamsRoute()}/create`). diff --git a/webapp/tests/client_team.test.jsx b/webapp/tests/client_team.test.jsx index 13b2802d2..009d084f8 100644 --- a/webapp/tests/client_team.test.jsx +++ b/webapp/tests/client_team.test.jsx @@ -328,5 +328,21 @@ describe('Client.Team', function() { ); }); }); + + it('getTeamByName', function(done) { + TestHelper.initBasic(() => { + TestHelper.basicClient().getTeamByName( + TestHelper.basicTeam().name, + function(data) { + console.log(data); + assert.equal(data.name, TestHelper.basicTeam().name); + done(); + }, + function(err) { + done(new Error(err.message)); + } + ); + }); + }); }); |