summaryrefslogtreecommitdiffstats
path: root/api/user_test.go
diff options
context:
space:
mode:
authorAsaad Mahmood <Unknowngi@live.com>2015-10-23 10:53:57 +0500
committerAsaad Mahmood <Unknowngi@live.com>2015-10-23 10:53:57 +0500
commitcc904a7ec73a44a337908c685bfc311bdbe1ff85 (patch)
tree6fb865bb734cad0389490e4add11f2e308fe473c /api/user_test.go
parent79ce0dd914713aac9d2f1332202a48e7e0d338a3 (diff)
parent02a6f6b2cd4c0a6bf32b23961557c385039ae2f2 (diff)
downloadchat-cc904a7ec73a44a337908c685bfc311bdbe1ff85.tar.gz
chat-cc904a7ec73a44a337908c685bfc311bdbe1ff85.tar.bz2
chat-cc904a7ec73a44a337908c685bfc311bdbe1ff85.zip
Merge branch 'master' of https://github.com/mattermost/platform into ui-improvements
Diffstat (limited to 'api/user_test.go')
-rw-r--r--api/user_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/api/user_test.go b/api/user_test.go
index 77309e5b2..b54e030c5 100644
--- a/api/user_test.go
+++ b/api/user_test.go
@@ -817,6 +817,16 @@ func TestSendPasswordReset(t *testing.T) {
if _, err := Client.SendPasswordReset(data); err == nil {
t.Fatal("Should have errored - bad name")
}
+
+ user2 := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", AuthData: "1", AuthService: "random"}
+ user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
+ store.Must(Srv.Store.User().VerifyEmail(user2.Id))
+
+ data["email"] = user2.Email
+ data["name"] = team.Name
+ if _, err := Client.SendPasswordReset(data); err == nil {
+ t.Fatal("should have errored - SSO user can't send reset password link")
+ }
}
func TestResetPassword(t *testing.T) {
@@ -901,6 +911,20 @@ func TestResetPassword(t *testing.T) {
if _, err := Client.ResetPassword(data); err == nil {
t.Fatal("Should have errored - domain team doesn't match user team")
}
+
+ user2 := &model.User{TeamId: team.Id, Email: strings.ToLower(model.NewId()) + "corey@test.com", Nickname: "Corey Hulen", AuthData: "1", AuthService: "random"}
+ user2 = Client.Must(Client.CreateUser(user2, "")).Data.(*model.User)
+ store.Must(Srv.Store.User().VerifyEmail(user2.Id))
+
+ data["new_password"] = "newpwd"
+ props["user_id"] = user2.Id
+ props["time"] = fmt.Sprintf("%v", model.GetMillis())
+ data["data"] = model.MapToJson(props)
+ data["hash"] = model.HashPassword(fmt.Sprintf("%v:%v", data["data"], utils.Cfg.EmailSettings.PasswordResetSalt))
+ data["name"] = team.Name
+ if _, err := Client.ResetPassword(data); err == nil {
+ t.Fatal("should have errored - SSO user can't reset password")
+ }
}
func TestUserUpdateNotify(t *testing.T) {