diff options
author | Ola Aunronning <olaa@yahooinc.com> | 2022-10-26 10:36:06 +0200 |
---|---|---|
committer | Ola Aunronning <olaa@yahooinc.com> | 2022-10-26 10:36:06 +0200 |
commit | 4f24cedcbe9bcccd9a152d2e6b6e14a1b41f86aa (patch) | |
tree | 9cbd16a2f5ddd9baf8e6eb13f6671345b9ceee9c /controller-server/src/test | |
parent | 7df1fd635ba6bb1a713eef150cd3a635906e74e4 (diff) |
Write to Zookeeper before sending mail. Change API resource name
Diffstat (limited to 'controller-server/src/test')
-rw-r--r-- | controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java index b573940d150..075e001655f 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/user/UserApiTest.java @@ -10,11 +10,11 @@ import com.yahoo.vespa.flags.PermanentFlags; import com.yahoo.vespa.hosted.controller.ControllerTester; import com.yahoo.vespa.hosted.controller.api.integration.billing.PlanId; import com.yahoo.jdisc.http.filter.security.misc.User; -import com.yahoo.vespa.hosted.controller.api.integration.stubs.MockUserManagement; import com.yahoo.vespa.hosted.controller.api.integration.user.UserId; import com.yahoo.vespa.hosted.controller.api.role.Role; import com.yahoo.vespa.hosted.controller.restapi.ContainerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerCloudTest; +import com.yahoo.vespa.hosted.controller.tenant.PendingMailVerification; import com.yahoo.vespa.hosted.controller.tenant.Tenant; import org.junit.jupiter.api.Test; @@ -321,4 +321,20 @@ public class UserApiTest extends ControllerContainerCloudTest { } } + + @Test + public void verifyMail() { + var tester = new ContainerTester(container, responseFiles); + var controller = new ControllerTester(tester); + controller.createTenant("tenant1", Tenant.Type.cloud); + var pendingMailVerification = tester.controller().mailVerifier().sendMailVerification(TenantName.from("tenant1"), "foo@bar.com", PendingMailVerification.MailType.NOTIFICATIONS); + + tester.assertResponse(request("/user/v1/email/verify", POST) + .data("{\"verificationCode\":\"blurb\"}"), + "{\"error-code\":\"NOT_FOUND\",\"message\":\"No pending email verification with code blurb found\"}", 404); + + tester.assertResponse(request("/user/v1/email/verify", POST) + .data("{\"verificationCode\":\"" + pendingMailVerification.getVerificationCode() + "\"}"), + "{\"message\":\"Email with verification code " + pendingMailVerification.getVerificationCode() + " has been verified\"}", 200); + } } |