aboutsummaryrefslogtreecommitdiffstats
path: root/it
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2016-01-28 17:32:12 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2016-02-01 13:46:17 +0100
commit961911bf82fb9592fc6495b42a0dd3cbcfec2974 (patch)
tree94056c4580b68b2feac1679902f7df64d7c47b6d /it
parent9873d47828cb1e4c2142adcbd94583910a8055af (diff)
downloadsonarqube-961911bf82fb9592fc6495b42a0dd3cbcfec2974.tar.gz
sonarqube-961911bf82fb9592fc6495b42a0dd3cbcfec2974.zip
SONAR-7233 remove email / SCM accounts when deactivating a user
Diffstat (limited to 'it')
-rw-r--r--it/it-tests/src/test/java/it/authorisation/BaseIdentityProviderTest.java19
-rw-r--r--it/it-tests/src/test/java/it/authorisation/OAuth2IdentityProviderTest.java6
2 files changed, 19 insertions, 6 deletions
diff --git a/it/it-tests/src/test/java/it/authorisation/BaseIdentityProviderTest.java b/it/it-tests/src/test/java/it/authorisation/BaseIdentityProviderTest.java
index cb789b06c14..705ce8c5684 100644
--- a/it/it-tests/src/test/java/it/authorisation/BaseIdentityProviderTest.java
+++ b/it/it-tests/src/test/java/it/authorisation/BaseIdentityProviderTest.java
@@ -23,9 +23,9 @@ import com.google.common.base.Optional;
import com.sonar.orchestrator.Orchestrator;
import it.Category1Suite;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
-import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.sonarqube.ws.client.GetRequest;
@@ -66,9 +66,17 @@ public class BaseIdentityProviderTest {
setServerProperty(ORCHESTRATOR, "sonar.auth.fake-base-id-provider.enabled", "true");
}
+ @AfterClass
+ public static void disableAuthPlugin() throws Exception {
+ setServerProperty(ORCHESTRATOR, "sonar.auth.fake-base-id-provider.enabled", "false");
+ }
+
@After
- public void removeUsers() throws Exception {
- userRule.deactivateUsers(userRule.getUsersByEmails(USER_EMAIL, USER_EMAIL_UPDATED));
+ public void removeUser() throws Exception {
+ Optional<Users.User> user = userRule.getUserByLogin(USER_LOGIN);
+ if (user.isPresent()) {
+ userRule.deactivateUsers(user.get());
+ }
}
@Test
@@ -99,7 +107,6 @@ public class BaseIdentityProviderTest {
}
@Test
- @Ignore("Waiting for SONAR-7233 to be implemented")
public void reactivate_disabled_user() throws Exception {
setUserCreatedByAuthPlugin(USER_LOGIN, USER_PROVIDER_ID, USER_NAME, USER_EMAIL);
@@ -108,7 +115,7 @@ public class BaseIdentityProviderTest {
// First connection, user is created
authenticateWithFakeAuthProvider();
- Optional<Users.User> user = userRule.getUserByLogin(USER_EMAIL);
+ Optional<Users.User> user = userRule.getUserByLogin(USER_LOGIN);
assertThat(user).isPresent();
// Disable user
@@ -119,7 +126,7 @@ public class BaseIdentityProviderTest {
userRule.verifyUserExists(USER_LOGIN, USER_NAME, USER_EMAIL);
}
- private void setUserCreatedByAuthPlugin(String login, String providerId, String name, String email){
+ private void setUserCreatedByAuthPlugin(String login, String providerId, String name, String email) {
setServerProperty(ORCHESTRATOR, "sonar.auth.fake-base-id-provider.user", login + "," + providerId + "," + name + "," + email);
}
diff --git a/it/it-tests/src/test/java/it/authorisation/OAuth2IdentityProviderTest.java b/it/it-tests/src/test/java/it/authorisation/OAuth2IdentityProviderTest.java
index 9d34c18d935..1919bcf5777 100644
--- a/it/it-tests/src/test/java/it/authorisation/OAuth2IdentityProviderTest.java
+++ b/it/it-tests/src/test/java/it/authorisation/OAuth2IdentityProviderTest.java
@@ -25,6 +25,7 @@ import com.squareup.okhttp.mockwebserver.MockWebServer;
import it.Category1Suite;
import java.net.HttpURLConnection;
import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
@@ -77,6 +78,11 @@ public class OAuth2IdentityProviderTest {
fakeServerAuthProvider.shutdown();
}
+ @AfterClass
+ public static void disableAuthPlugin() throws Exception {
+ setServerProperty(ORCHESTRATOR, "sonar.auth.fake-oauth2-id-provider.enabled", "false");
+ }
+
@Test
public void create_new_user_when_authenticate() throws Exception {
simulateRedirectionToCallback();