diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-09-24 08:14:30 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-09-24 08:14:30 -0400 |
commit | 54c7dba33dc707fa7013a87040c8a8e5d7b237e9 (patch) | |
tree | 6afeaf5fc7f7876f3e7677ed19a83d3e3dce3b44 /api/user_test.go | |
parent | 56f76502e3edcc95f7a0e9c8fe5b3d523b33ee29 (diff) | |
parent | 00112cae5123b02eee79e8b991618ed5069e07b1 (diff) | |
download | chat-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/user_test.go')
-rw-r--r-- | api/user_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/api/user_test.go b/api/user_test.go index 669da4d20..baa567dec 100644 --- a/api/user_test.go +++ b/api/user_test.go @@ -228,6 +228,13 @@ func TestGetUser(t *testing.T) { ruser2, _ := Client.CreateUser(&user2, "") store.Must(Srv.Store.User().VerifyEmail(ruser2.Data.(*model.User).Id)) + team2 := model.Team{DisplayName: "Name", Name: "z-z-" + model.NewId() + "a", Email: "test@nowhere.com", Type: model.TEAM_OPEN} + rteam2, _ := Client.CreateTeam(&team2) + + user3 := model.User{TeamId: rteam2.Data.(*model.Team).Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", Password: "pwd"} + ruser3, _ := Client.CreateUser(&user3, "") + store.Must(Srv.Store.User().VerifyEmail(ruser3.Data.(*model.User).Id)) + Client.LoginByEmail(team.Name, user.Email, user.Password) rId := ruser.Data.(*model.User).Id @@ -276,13 +283,27 @@ func TestGetUser(t *testing.T) { t.Log(cache_result.Data) t.Fatal("cache should be empty") } + } + if _, err := Client.GetProfiles(rteam2.Data.(*model.Team).Id, ""); err == nil { + t.Fatal("shouldn't have access") } Client.AuthToken = "" if _, err := Client.GetUser(ruser2.Data.(*model.User).Id, ""); err == nil { t.Fatal("shouldn't have accss") } + + c := &Context{} + c.RequestId = model.NewId() + c.IpAddress = "cmd_line" + UpdateRoles(c, ruser.Data.(*model.User), model.ROLE_SYSTEM_ADMIN) + + Client.LoginByEmail(team.Name, user.Email, "pwd") + + if _, err := Client.GetProfiles(rteam2.Data.(*model.Team).Id, ""); err != nil { + t.Fatal(err) + } } func TestGetAudits(t *testing.T) { |