summaryrefslogtreecommitdiffstats
path: root/api/team_test.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-07-06 13:40:59 -0800
committerGitHub <noreply@github.com>2016-07-06 13:40:59 -0800
commitd5f243dad694d6746ec2b6560a81212a78d8c975 (patch)
tree7f1de697c906ff909f26b739eebaa77f18edf790 /api/team_test.go
parent3eee51f74e893f3182519ad0edb72dd5d8b107fd (diff)
downloadchat-d5f243dad694d6746ec2b6560a81212a78d8c975.tar.gz
chat-d5f243dad694d6746ec2b6560a81212a78d8c975.tar.bz2
chat-d5f243dad694d6746ec2b6560a81212a78d8c975.zip
PLT-2863 adding remove user from team (#3429)
* PLT-2863 adding remove user from team * PLT-2863 adding the client side UI * Fixing trailing space * Fixing reported issues * Adding documentatino * Switching to final javascript driver
Diffstat (limited to 'api/team_test.go')
-rw-r--r--api/team_test.go35
1 files changed, 34 insertions, 1 deletions
diff --git a/api/team_test.go b/api/team_test.go
index a62ffcdb5..9fc3e8105 100644
--- a/api/team_test.go
+++ b/api/team_test.go
@@ -158,7 +158,7 @@ func TestAddUserToTeam(t *testing.T) {
}
user2 := th.CreateUser(th.BasicClient)
- if result, err := th.BasicClient.AddUserToTeam(user2.Id); err != nil {
+ if result, err := th.BasicClient.AddUserToTeam("", user2.Id); err != nil {
t.Fatal(err)
} else {
rm := result.Data.(map[string]string)
@@ -168,6 +168,39 @@ func TestAddUserToTeam(t *testing.T) {
}
}
+func TestRemoveUserFromTeam(t *testing.T) {
+ th := Setup().InitSystemAdmin().InitBasic()
+
+ if _, err := th.BasicClient.RemoveUserFromTeam(th.SystemAdminTeam.Id, th.SystemAdminUser.Id); err == nil {
+ t.Fatal("should fail not enough permissions")
+ } else {
+ if err.Id != "api.context.permissions.app_error" {
+ t.Fatal("wrong error")
+ }
+ }
+
+ if _, err := th.BasicClient.RemoveUserFromTeam("", th.SystemAdminUser.Id); err == nil {
+ t.Fatal("should fail not enough permissions")
+ } else {
+ if err.Id != "api.team.update_team.permissions.app_error" {
+ t.Fatal("wrong error")
+ }
+ }
+
+ if _, err := th.BasicClient.RemoveUserFromTeam("", th.BasicUser.Id); err != nil {
+ t.Fatal("should have removed the user from the team")
+ }
+
+ th.BasicClient.Logout()
+ th.LoginSystemAdmin()
+
+ th.SystemAdminClient.Must(th.SystemAdminClient.AddUserToTeam(th.BasicTeam.Id, th.BasicUser.Id))
+
+ if _, err := th.SystemAdminClient.RemoveUserFromTeam(th.BasicTeam.Id, th.BasicUser.Id); err != nil {
+ t.Fatal("should have removed the user from the team")
+ }
+}
+
func TestAddUserToTeamFromInvite(t *testing.T) {
th := Setup().InitBasic()
th.BasicClient.Logout()