From: Julien Lancelot Date: Tue, 29 Nov 2016 13:36:28 +0000 (+0100) Subject: SONAR-8416 Add IT in SSO authentication X-Git-Tag: 6.2.1~11 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=257fe4bcb4fe30d7afdd4f05f2838ca40c08314f;p=sonarqube.git 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 --- 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); }