summaryrefslogtreecommitdiffstats
path: root/api/team_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2016-12-01 23:23:28 +0100
committerJoram Wilander <jwawilander@gmail.com>2016-12-01 17:23:28 -0500
commitc51afba71a8d4614f74709d5e9c432c2cff3fcf7 (patch)
tree8b2ad4586123c5a7bab8c44f91dd8eebbfaea674 /api/team_test.go
parent8c18da21f3e51421a0dc6fbd4be1fa1e838dd482 (diff)
downloadchat-c51afba71a8d4614f74709d5e9c432c2cff3fcf7.tar.gz
chat-c51afba71a8d4614f74709d5e9c432c2cff3fcf7.tar.bz2
chat-c51afba71a8d4614f74709d5e9c432c2cff3fcf7.zip
Add Team Description to the Team Settings (#4652)
* draft * Add Team Description to the Team Settings * add tooltips for team description * made changes per PM review * add message when there is no description set in the team * squash
Diffstat (limited to 'api/team_test.go')
-rw-r--r--api/team_test.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/api/team_test.go b/api/team_test.go
index ec3c40e51..910b58041 100644
--- a/api/team_test.go
+++ b/api/team_test.go
@@ -759,3 +759,43 @@ func TestGetTeamStats(t *testing.T) {
t.Fatal("should have errored - not on team")
}
}
+
+func TestUpdateTeamDescription(t *testing.T) {
+ th := Setup().InitBasic()
+ th.BasicClient.Logout()
+ Client := th.BasicClient
+
+ team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "success+" + model.NewId() + "@simulator.amazonses.com", Type: model.TEAM_OPEN}
+ team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
+
+ user := &model.User{Email: team.Email, Nickname: "My Testing", Password: "passwd1"}
+ user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
+ LinkUserToTeam(user, team)
+ store.Must(Srv.Store.User().VerifyEmail(user.Id))
+
+ user2 := &model.User{Email: "success+" + model.NewId() + "@simulator.amazonses.com", Nickname: "Jabba the Hutt", Password: "passwd1"}
+ user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
+ LinkUserToTeam(user2, team)
+ store.Must(Srv.Store.User().VerifyEmail(user2.Id))
+
+ Client.Login(user2.Email, "passwd1")
+ Client.SetTeamId(team.Id)
+
+ vteam := &model.Team{DisplayName: team.DisplayName, Name: team.Name, Description: team.Description, Email: team.Email, Type: team.Type}
+ vteam.Description = "yommamma"
+ if _, err := Client.UpdateTeam(vteam); err == nil {
+ t.Fatal("Should have errored, not admin")
+ }
+
+ Client.Login(user.Email, "passwd1")
+
+ vteam.Description = ""
+ if _, err := Client.UpdateTeam(vteam); err != nil {
+ t.Fatal("Should have errored, should save blank Description")
+ }
+
+ vteam.Description = "yommamma"
+ if _, err := Client.UpdateTeam(vteam); err != nil {
+ t.Fatal(err)
+ }
+}