summaryrefslogtreecommitdiffstats
path: root/api4/user_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-31 09:31:53 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-31 09:31:53 -0500
commit0bc0a467a48b170124f10ed37590f6e984f54e1c (patch)
tree1d33b42f2dc1bd5e52147bed478c350c3595db3f /api4/user_test.go
parent7e9cf13aa356f991f48ba0a943bdab9b4d3c9233 (diff)
downloadchat-0bc0a467a48b170124f10ed37590f6e984f54e1c.tar.gz
chat-0bc0a467a48b170124f10ed37590f6e984f54e1c.tar.bz2
chat-0bc0a467a48b170124f10ed37590f6e984f54e1c.zip
Improve APIv4 test lib (#5237)
Diffstat (limited to 'api4/user_test.go')
-rw-r--r--api4/user_test.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/api4/user_test.go b/api4/user_test.go
index d643f4e3a..c55c70b36 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -40,18 +40,18 @@ func TestCreateUser(t *testing.T) {
ruser.Username = GenerateTestUsername()
ruser.Password = "passwd1"
_, resp = Client.CreateUser(ruser)
- CheckErrorMessage(t, resp, "An account with that email already exists.")
+ CheckErrorMessage(t, resp, "store.sql_user.save.email_exists.app_error")
CheckBadRequestStatus(t, resp)
ruser.Email = GenerateTestEmail()
ruser.Username = user.Username
_, resp = Client.CreateUser(ruser)
- CheckErrorMessage(t, resp, "An account with that username already exists.")
+ CheckErrorMessage(t, resp, "store.sql_user.save.username_exists.app_error")
CheckBadRequestStatus(t, resp)
ruser.Email = ""
_, resp = Client.CreateUser(ruser)
- CheckErrorMessage(t, resp, "Invalid email")
+ CheckErrorMessage(t, resp, "model.user.is_valid.email.app_error")
CheckBadRequestStatus(t, resp)
if r, err := Client.DoApiPost("/users", "garbage"); err == nil {
@@ -116,8 +116,7 @@ func TestGetUser(t *testing.T) {
CheckUnauthorizedStatus(t, resp)
// System admins should ignore privacy settings
- th.LoginSystemAdmin()
- ruser, resp = Client.GetUser(user.Id, resp.Etag)
+ ruser, resp = th.SystemAdminClient.GetUser(user.Id, resp.Etag)
if ruser.Email == "" {
t.Fatal("email should not be blank")
}
@@ -180,7 +179,6 @@ func TestUpdateUser(t *testing.T) {
_, resp = Client.UpdateUser(user)
CheckForbiddenStatus(t, resp)
- th.LoginSystemAdmin()
- _, resp = Client.UpdateUser(user)
+ _, resp = th.SystemAdminClient.UpdateUser(user)
CheckNoError(t, resp)
}