From cef1973ee4331bef1adc488db035b1e3a87c23fc Mon Sep 17 00:00:00 2001 From: Vlasta Ramik Date: Wed, 2 Nov 2016 13:46:53 +0100 Subject: [PATCH] KEYCLOAK-3579 add preview profile assumption to tests --- .../java/org/keycloak/testsuite/admin/PermissionsTest.java | 2 ++ .../keycloak/testsuite/exportimport/ExportImportUtil.java | 7 +++++-- .../test/java/org/keycloak/testsuite/i18n/EmailTest.java | 5 +++-- .../java/org/keycloak/testsuite/i18n/LoginPageTest.java | 4 +++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java index 29252d98d4..7d005e95dd 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/PermissionsTest.java @@ -78,6 +78,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.fail; import static org.keycloak.services.resources.admin.RealmAuth.Resource.AUTHORIZATION; import static org.keycloak.services.resources.admin.RealmAuth.Resource.CLIENT; +import org.keycloak.testsuite.ProfileAssume; /** * @author Stian Thorgersen @@ -782,6 +783,7 @@ public class PermissionsTest extends AbstractKeycloakTest { @Test public void clientAuthorization() { + ProfileAssume.assumePreview(); invoke(new InvocationWithResponse() { public void invoke(RealmResource realm, AtomicReference response) { realm.clients().create(ClientBuilder.create().clientId("foo-authz").build()); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java index 386b291659..2c45818773 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/exportimport/ExportImportUtil.java @@ -61,6 +61,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.function.Predicate; +import org.keycloak.common.Profile; /** * @@ -374,8 +375,10 @@ public class ExportImportUtil { UserRepresentation linked = testingClient.testing().getUserByServiceAccountClient(realm.getRealm(), otherApp.getClientId());//session.users().getUserByServiceAccountClient(otherApp); Assert.assertNotNull(linked); Assert.assertEquals("my-service-user", linked.getUsername()); - - assertAuthorizationSettings(realmRsc); + + if (Profile.isPreviewEnabled()) { + assertAuthorizationSettings(realmRsc); + } } private static boolean isProtocolMapperGranted(Map consent, ProtocolMapperRepresentation mapperRep) { diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/EmailTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/EmailTest.java index 42f85e6e70..163f60209f 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/EmailTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/EmailTest.java @@ -30,10 +30,9 @@ import org.keycloak.testsuite.util.GreenMailRule; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; import static org.junit.Assert.assertEquals; +import org.keycloak.testsuite.ProfileAssume; /** * @author Michael Gerber @@ -84,6 +83,8 @@ public class EmailTest extends AbstractI18NTest { @Test public void restPasswordEmailGerman() throws IOException, MessagingException { + ProfileAssume.assumePreview(); + changeUserLocale("de"); loginPage.open(); diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/LoginPageTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/LoginPageTest.java index 4a0da21ecf..3bc1a0231d 100755 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/LoginPageTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/i18n/LoginPageTest.java @@ -17,7 +17,6 @@ package org.keycloak.testsuite.i18n; import org.apache.http.impl.client.DefaultHttpClient; -import org.jboss.arquillian.graphene.page.Page; import org.jboss.resteasy.client.jaxrs.ResteasyClient; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine; @@ -29,6 +28,7 @@ import org.keycloak.testsuite.pages.LoginPage; import javax.ws.rs.core.Response; import org.jboss.arquillian.graphene.page.Page; +import org.keycloak.testsuite.ProfileAssume; import org.keycloak.testsuite.util.IdentityProviderBuilder; /** @@ -97,6 +97,8 @@ public class LoginPageTest extends AbstractI18NTest { @Test public void acceptLanguageHeader() { + ProfileAssume.assumePreview(); + DefaultHttpClient httpClient = (DefaultHttpClient) new HttpClientBuilder().build(); ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient); ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();