diff options
author | Saturnino Abril <saturnino.abril@gmail.com> | 2017-02-21 01:27:57 +0900 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2017-02-20 13:27:57 -0300 |
commit | 623560481b4bce2b87f19765455a461c7a504e31 (patch) | |
tree | e05071527ce330275f961928948d8ad291fd55a6 /api4/team_test.go | |
parent | 22118fafc8650214a3de13cf0cfa5a698b0e9a4a (diff) | |
download | chat-623560481b4bce2b87f19765455a461c7a504e31.tar.gz chat-623560481b4bce2b87f19765455a461c7a504e31.tar.bz2 chat-623560481b4bce2b87f19765455a461c7a504e31.zip |
Implementation endpoint for APIv4: GET /teams/name/{name} (#5473)
* APIv4: GET /teams/name/{name}
Signed-off-by: Saturnino Abril <saturnino.abril@gmail.com>
* reorganized test with SystemAdminClient
Signed-off-by: Saturnino Abril <saturnino.abril@gmail.com>
Diffstat (limited to 'api4/team_test.go')
-rw-r--r-- | api4/team_test.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/api4/team_test.go b/api4/team_test.go index 5f7bc7b98..32f1bc967 100644 --- a/api4/team_test.go +++ b/api4/team_test.go @@ -114,6 +114,42 @@ func TestGetTeam(t *testing.T) { CheckNoError(t, resp) } +func TestGetTeamByName(t *testing.T) { + th := Setup().InitBasic().InitSystemAdmin() + defer TearDown() + Client := th.Client + team := th.BasicTeam + + rteam, resp := Client.GetTeamByName(team.Name, "") + CheckNoError(t, resp) + + if rteam.Name != team.Name { + t.Fatal("wrong team") + } + + _, resp = Client.GetTeamByName("junk", "") + CheckNotFoundStatus(t, resp) + + _, resp = Client.GetTeamByName("", "") + CheckNotFoundStatus(t, resp) + + Client.Logout() + _, resp = Client.GetTeamByName(team.Name, "") + CheckUnauthorizedStatus(t, resp) + + _, resp = th.SystemAdminClient.GetTeamByName(team.Name, "") + CheckNoError(t, resp) + + th.LoginTeamAdmin() + + team2 := &model.Team{DisplayName: "Name", Name: GenerateTestTeamName(), Email: GenerateTestEmail(), Type: model.TEAM_INVITE} + rteam2, _ := Client.CreateTeam(team2) + + th.LoginBasic() + _, resp = Client.GetTeamByName(rteam2.Name, "") + CheckForbiddenStatus(t, resp) +} + func TestGetTeamsForUser(t *testing.T) { th := Setup().InitBasic().InitSystemAdmin() defer TearDown() |