From 257fe4bcb4fe30d7afdd4f05f2838ca40c08314f Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 29 Nov 2016 14:36:28 +0100 Subject: [PATCH] SONAR-8416 Add IT in SSO authentication This test is checking that the ui is displaying an explicit message when a user try to authenticate with the same email than an existing one --- .../src/test/java/it/user/SsoAuthenticationTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java b/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java index df84677bae2..7c723037336 100644 --- a/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java +++ b/it/it-tests/src/test/java/it/user/SsoAuthenticationTest.java @@ -137,6 +137,18 @@ public class SsoAuthenticationTest { USER_RULE.verifyUserDoesNotExist(USER_LOGIN); } + @Test + public void fail_when_email_already_exists() throws Exception { + USER_RULE.createUser("another", "Another", USER_EMAIL, "another"); + + Response response = call(USER_LOGIN, USER_NAME, USER_EMAIL, null); + + String expectedError = "You can't sign up because email 'tester@email.com' is already used by an existing user. This means that you probably already registered with another account"; + assertThat(response.code()).isEqualTo(200); + assertThat(response.body().string()).contains(expectedError); + assertThat(FileUtils.readLines(orchestrator.getServer().getWebLogs(), Charsets.UTF_8)).doesNotContain(expectedError); + } + private static Response call(String login, @Nullable String name, @Nullable String email, @Nullable String groups) { return doCall(login, name, email, groups); } -- 2.39.5