summaryrefslogtreecommitdiffstats
path: root/api/team_test.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2015-09-24 08:14:30 -0400
committerChristopher Speller <crspeller@gmail.com>2015-09-24 08:14:30 -0400
commit54c7dba33dc707fa7013a87040c8a8e5d7b237e9 (patch)
tree6afeaf5fc7f7876f3e7677ed19a83d3e3dce3b44 /api/team_test.go
parent56f76502e3edcc95f7a0e9c8fe5b3d523b33ee29 (diff)
parent00112cae5123b02eee79e8b991618ed5069e07b1 (diff)
downloadchat-54c7dba33dc707fa7013a87040c8a8e5d7b237e9.tar.gz
chat-54c7dba33dc707fa7013a87040c8a8e5d7b237e9.tar.bz2
chat-54c7dba33dc707fa7013a87040c8a8e5d7b237e9.zip
Merge pull request #765 from mattermost/PLT-349
PLT-349 adding team mgt to admin console
Diffstat (limited to 'api/team_test.go')
-rw-r--r--api/team_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/api/team_test.go b/api/team_test.go
index cd39dacfe..e2a7cf430 100644
--- a/api/team_test.go
+++ b/api/team_test.go
@@ -132,6 +132,39 @@ func TestFindTeamByEmail(t *testing.T) {
}
}
+func TestGetAllTeams(t *testing.T) {
+ Setup()
+
+ team := &model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN}
+ team = Client.Must(Client.CreateTeam(team)).Data.(*model.Team)
+
+ user := &model.User{TeamId: team.Id, Email: model.NewId() + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"}
+ user = Client.Must(Client.CreateUser(user, "")).Data.(*model.User)
+ store.Must(Srv.Store.User().VerifyEmail(user.Id))
+
+ Client.LoginByEmail(team.Name, user.Email, "pwd")
+
+ if _, err := Client.GetAllTeams(); err == nil {
+ t.Fatal("you shouldn't have permissions")
+ }
+
+ c := &Context{}
+ c.RequestId = model.NewId()
+ c.IpAddress = "cmd_line"
+ UpdateRoles(c, user, model.ROLE_SYSTEM_ADMIN)
+
+ Client.LoginByEmail(team.Name, user.Email, "pwd")
+
+ if r1, err := Client.GetAllTeams(); err != nil {
+ t.Fatal(err)
+ } else {
+ teams := r1.Data.(map[string]*model.Team)
+ if teams[team.Id].Name != team.Name {
+ t.Fatal()
+ }
+ }
+}
+
/*
XXXXXX investigate and fix failing test