Merge pull request #4402 from mhajas/KEYCLOAK-5312

KEYCLOAK-5312 Add preview profile assumption to authz tests
This commit is contained in:
Pavel Drozd 2017-08-25 11:25:00 +02:00 committed by GitHub
commit 9b858907ec
12 changed files with 50 additions and 10 deletions

View file

@ -22,6 +22,7 @@ import java.util.List;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.BeforeClass;
import org.junit.Test;
import org.keycloak.admin.client.resource.ClientsResource;
import org.keycloak.authorization.AuthorizationProvider;
@ -37,6 +38,7 @@ import org.keycloak.representations.idm.authorization.Logic;
import org.keycloak.representations.idm.authorization.ResourceServerRepresentation;
import org.keycloak.representations.idm.authorization.RolePolicyRepresentation;
import org.keycloak.testsuite.AbstractKeycloakTest;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
import org.keycloak.testsuite.util.ClientBuilder;
import org.keycloak.testsuite.util.RealmBuilder;
@ -48,6 +50,11 @@ import org.keycloak.util.JsonSerialization;
*/
public class AuthzCleanupTest extends AbstractKeycloakTest {
@BeforeClass
public static void enabled() {
ProfileAssume.assumePreview();
}
@Deployment
public static WebArchive deploy() {
return RunOnServerDeployment.create();

View file

@ -31,6 +31,7 @@ import java.util.function.Supplier;
import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.BeforeClass;
import org.keycloak.admin.client.resource.ClientResource;
import org.keycloak.admin.client.resource.ClientsResource;
import org.keycloak.admin.client.resource.RealmResource;
@ -41,6 +42,7 @@ import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import org.keycloak.representations.idm.authorization.ScopeRepresentation;
import org.keycloak.representations.idm.authorization.UserPolicyRepresentation;
import org.keycloak.testsuite.AbstractKeycloakTest;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.util.ClientBuilder;
import org.keycloak.testsuite.util.RealmBuilder;
import org.keycloak.testsuite.util.UserBuilder;
@ -50,6 +52,11 @@ import org.keycloak.testsuite.util.UserBuilder;
*/
public abstract class AbstractPolicyManagementTest extends AbstractKeycloakTest {
@BeforeClass
public static void enabled() {
ProfileAssume.assumePreview();
}
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
testRealms.add(createTestRealm().build());

View file

@ -0,0 +1,16 @@
package org.keycloak.testsuite.authz;
import org.junit.BeforeClass;
import org.keycloak.testsuite.AbstractKeycloakTest;
import org.keycloak.testsuite.ProfileAssume;
/**
* @author mhajas
*/
public abstract class AbstractAuthzTest extends AbstractKeycloakTest {
@BeforeClass
public static void enabled() {
ProfileAssume.assumePreview();
}
}

View file

@ -64,7 +64,7 @@ import org.keycloak.testsuite.util.UserBuilder;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class AuthzClientCredentialsTest extends AbstractKeycloakTest {
public class AuthzClientCredentialsTest extends AbstractAuthzTest {
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {

View file

@ -59,7 +59,7 @@ import org.keycloak.util.JsonSerialization;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class ConflictingScopePermissionTest extends AbstractKeycloakTest {
public class ConflictingScopePermissionTest extends AbstractAuthzTest {
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {

View file

@ -58,7 +58,7 @@ import org.keycloak.util.JsonSerialization;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public class EntitlementAPITest extends AbstractKeycloakTest {
public class EntitlementAPITest extends AbstractAuthzTest {
private AuthzClient authzClient;

View file

@ -63,7 +63,7 @@ import org.keycloak.util.JsonSerialization;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public class GroupNamePolicyTest extends AbstractKeycloakTest {
public class GroupNamePolicyTest extends AbstractAuthzTest {
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {

View file

@ -66,7 +66,7 @@ import org.keycloak.util.JsonSerialization;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public class GroupPathPolicyTest extends AbstractKeycloakTest {
public class GroupPathPolicyTest extends AbstractAuthzTest {
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {

View file

@ -19,6 +19,7 @@ package org.keycloak.testsuite.authz;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
import org.keycloak.admin.client.resource.RealmResource;
import org.keycloak.authorization.AuthorizationProvider;
@ -42,6 +43,7 @@ import org.keycloak.representations.idm.authorization.PolicyEvaluationResponse;
import org.keycloak.representations.idm.authorization.PolicyRepresentation;
import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation;
import org.keycloak.testsuite.AbstractKeycloakTest;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.runonserver.RunOnServerDeployment;
import java.util.HashMap;
@ -54,7 +56,8 @@ import static org.keycloak.testsuite.auth.page.AuthRealm.TEST;
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class PolicyEvaluationCompositeRoleTest extends AbstractKeycloakTest {
public class PolicyEvaluationCompositeRoleTest extends AbstractAuthzTest {
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {
RealmRepresentation testRealmRep = new RealmRepresentation();
@ -66,7 +69,7 @@ public class PolicyEvaluationCompositeRoleTest extends AbstractKeycloakTest {
@Deployment
public static WebArchive deploy() {
return RunOnServerDeployment.create();
return RunOnServerDeployment.create(AbstractAuthzTest.class);
}
public static void setup(KeycloakSession session) {

View file

@ -55,7 +55,7 @@ import org.keycloak.util.JsonSerialization;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public class RequireUmaAuthorizationScopeTest extends AbstractKeycloakTest {
public class RequireUmaAuthorizationScopeTest extends AbstractAuthzTest {
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {

View file

@ -59,7 +59,7 @@ import org.keycloak.util.JsonSerialization;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
public class RolePolicyTest extends AbstractKeycloakTest {
public class RolePolicyTest extends AbstractAuthzTest {
@Override
public void addTestRealms(List<RealmRepresentation> testRealms) {

View file

@ -22,7 +22,9 @@ import static org.keycloak.testsuite.auth.page.login.Login.OIDC;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before;
import org.junit.BeforeClass;
import org.keycloak.representations.idm.ClientRepresentation;
import org.keycloak.testsuite.ProfileAssume;
import org.keycloak.testsuite.console.clients.AbstractClientTest;
import org.keycloak.testsuite.console.page.clients.authorization.Authorization;
import org.keycloak.testsuite.console.page.clients.settings.ClientSettings;
@ -41,6 +43,11 @@ public abstract class AbstractAuthorizationSettingsTest extends AbstractClientTe
protected ClientRepresentation newClient;
@BeforeClass
public static void enabled() {
ProfileAssume.assumePreview();
}
@Before
public void configureTest() {
this.newClient = createResourceServer();