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
Этот коммит содержится в:
Corey Hulen
2016-07-06 13:40:59 -08:00
коммит произвёл GitHub
родитель 3eee51f74e
Коммит d5f243dad6
24 изменённых файлов: 572 добавлений и 19 удалений

Просмотреть файл

@@ -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()