From 7fc5dc236aa2437e81b238f65d39c2f795eac493 Mon Sep 17 00:00:00 2001 From: Carlos Tadeu Panato Junior Date: Fri, 24 Feb 2017 14:27:47 +0100 Subject: add implementation for verify email for apiv4 (#5502) --- api4/user_test.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'api4/user_test.go') 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) +} -- cgit v1.2.3-1-g7c22