Merge pull request #3456 from vramik/KEYCLOAK-3579

KEYCLOAK-3579 add preview profile assumption to tests
This commit is contained in:
Pavel Drozd 2016-11-03 15:25:17 +01:00 committed by GitHub
commit f2b28d8215
4 changed files with 13 additions and 5 deletions

View file

@ -78,6 +78,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail; 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.AUTHORIZATION;
import static org.keycloak.services.resources.admin.RealmAuth.Resource.CLIENT; import static org.keycloak.services.resources.admin.RealmAuth.Resource.CLIENT;
import org.keycloak.testsuite.ProfileAssume;
/** /**
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a> * @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a>
@ -782,6 +783,7 @@ public class PermissionsTest extends AbstractKeycloakTest {
@Test @Test
public void clientAuthorization() { public void clientAuthorization() {
ProfileAssume.assumePreview();
invoke(new InvocationWithResponse() { invoke(new InvocationWithResponse() {
public void invoke(RealmResource realm, AtomicReference<Response> response) { public void invoke(RealmResource realm, AtomicReference<Response> response) {
realm.clients().create(ClientBuilder.create().clientId("foo-authz").build()); realm.clients().create(ClientBuilder.create().clientId("foo-authz").build());

View file

@ -61,6 +61,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.function.Predicate; 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); UserRepresentation linked = testingClient.testing().getUserByServiceAccountClient(realm.getRealm(), otherApp.getClientId());//session.users().getUserByServiceAccountClient(otherApp);
Assert.assertNotNull(linked); Assert.assertNotNull(linked);
Assert.assertEquals("my-service-user", linked.getUsername()); Assert.assertEquals("my-service-user", linked.getUsername());
assertAuthorizationSettings(realmRsc); if (Profile.isPreviewEnabled()) {
assertAuthorizationSettings(realmRsc);
}
} }
private static boolean isProtocolMapperGranted(Map<String, Object> consent, ProtocolMapperRepresentation mapperRep) { private static boolean isProtocolMapperGranted(Map<String, Object> consent, ProtocolMapperRepresentation mapperRep) {

View file

@ -30,10 +30,9 @@ import org.keycloak.testsuite.util.GreenMailRule;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import org.keycloak.testsuite.ProfileAssume;
/** /**
* @author <a href="mailto:gerbermichi@me.com">Michael Gerber</a> * @author <a href="mailto:gerbermichi@me.com">Michael Gerber</a>
@ -84,6 +83,8 @@ public class EmailTest extends AbstractI18NTest {
@Test @Test
public void restPasswordEmailGerman() throws IOException, MessagingException { public void restPasswordEmailGerman() throws IOException, MessagingException {
ProfileAssume.assumePreview();
changeUserLocale("de"); changeUserLocale("de");
loginPage.open(); loginPage.open();

View file

@ -17,7 +17,6 @@
package org.keycloak.testsuite.i18n; package org.keycloak.testsuite.i18n;
import org.apache.http.impl.client.DefaultHttpClient; 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.ResteasyClient;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder; import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine; 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 javax.ws.rs.core.Response;
import org.jboss.arquillian.graphene.page.Page; import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.util.IdentityProviderBuilder; import org.keycloak.testsuite.util.IdentityProviderBuilder;
/** /**
@ -97,6 +97,8 @@ public class LoginPageTest extends AbstractI18NTest {
@Test @Test
public void acceptLanguageHeader() { public void acceptLanguageHeader() {
ProfileAssume.assumePreview();
DefaultHttpClient httpClient = (DefaultHttpClient) new HttpClientBuilder().build(); DefaultHttpClient httpClient = (DefaultHttpClient) new HttpClientBuilder().build();
ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient); ApacheHttpClient4Engine engine = new ApacheHttpClient4Engine(httpClient);
ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build(); ResteasyClient client = new ResteasyClientBuilder().httpEngine(engine).build();