summaryrefslogtreecommitdiffstats
path: root/api/cli_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/cli_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/cli_test.go')
-rw-r--r--api/cli_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/api/cli_test.go b/api/cli_test.go
index 8184c2e06..ae2abee4a 100644
--- a/api/cli_test.go
+++ b/api/cli_test.go
@@ -334,6 +334,43 @@ func TestCliJoinTeam(t *testing.T) {
}
}
+func TestCliLeaveTeam(t *testing.T) {
+ if disableCliTests {
+ return
+ }
+
+ th := Setup().InitBasic()
+
+ cmd := exec.Command("bash", "-c", `go run ../mattermost.go -leave_team -team_name="`+th.BasicTeam.Name+`" -email="`+th.BasicUser.Email+`"`)
+ output, err := cmd.CombinedOutput()
+ if err != nil {
+ t.Log(string(output))
+ t.Fatal(err)
+ }
+
+ profiles := th.BasicClient.Must(th.BasicClient.GetProfiles(th.BasicTeam.Id, "")).Data.(map[string]*model.User)
+
+ found := false
+
+ for _, user := range profiles {
+ if user.Email == th.BasicUser.Email {
+ found = true
+ }
+
+ }
+
+ if !found {
+ t.Fatal("profile still should be in team even if deleted")
+ }
+
+ if result := <-Srv.Store.Team().GetTeamsByUserId(th.BasicUser.Id); result.Err != nil {
+ teamMembers := result.Data.([]*model.TeamMember)
+ if len(teamMembers) > 0 {
+ t.Fatal("Shouldn't be in team")
+ }
+ }
+}
+
func TestCliResetPassword(t *testing.T) {
if disableCliTests {
return