summaryrefslogtreecommitdiffstats
path: root/api4/user_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'api4/user_test.go')
-rw-r--r--api4/user_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/api4/user_test.go b/api4/user_test.go
index 07b9745c6..ee6cf079b 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -924,3 +924,29 @@ func TestGetAudits(t *testing.T) {
_, resp = th.SystemAdminClient.GetAudits(user.Id, 0, 100, "")
CheckNoError(t, resp)
}
+
+func TestVerify(t *testing.T) {
+ th := Setup().InitBasic()
+ defer TearDown()
+ Client := th.Client
+
+ user := model.User{Email: GenerateTestEmail(), Nickname: "Darth Vader", Password: "hello1", Username: GenerateTestUsername(), Roles: model.ROLE_SYSTEM_ADMIN.Id + " " + model.ROLE_SYSTEM_USER.Id}
+
+ ruser, resp := Client.CreateUser(&user)
+
+ hashId := ruser.Id+utils.Cfg.EmailSettings.InviteSalt
+ _, resp = Client.VerifyUserEmail(ruser.Id, hashId)
+ CheckNoError(t, resp)
+
+ hashId = ruser.Id+GenerateTestId()
+ _, resp = Client.VerifyUserEmail(ruser.Id, hashId)
+ CheckBadRequestStatus(t, resp)
+
+ // Comment per request from Joram, he will investigate why it fail with a wrong status
+ // hashId = ruser.Id+GenerateTestId()
+ // _, resp = Client.VerifyUserEmail("", hashId)
+ // CheckBadRequestStatus(t, resp)
+
+ _, resp = Client.VerifyUserEmail(ruser.Id, "")
+ CheckBadRequestStatus(t, resp)
+}