summaryrefslogtreecommitdiffstats
path: root/api/user_test.go
diff options
context:
space:
mode:
authorJack <jackdeng@gmail.com>2015-09-28 08:14:57 -0700
committerJack <jackdeng@gmail.com>2015-09-28 08:14:57 -0700
commit503501ab3b616fb9fa57b046df850cfc2db734f8 (patch)
tree43e529250bab982c73816f1ffdf673e8e4b98c13 /api/user_test.go
parentaa6da728baf2f5642293d8b56ebc1ff4e8682bce (diff)
parenta055fd10b83b28bf97877e4e28a2275f74a71a4a (diff)
downloadchat-503501ab3b616fb9fa57b046df850cfc2db734f8.tar.gz
chat-503501ab3b616fb9fa57b046df850cfc2db734f8.tar.bz2
chat-503501ab3b616fb9fa57b046df850cfc2db734f8.zip
rebase
Diffstat (limited to 'api/user_test.go')
-rw-r--r--api/user_test.go21
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) {