Merge pull request #4402 from mhajas/KEYCLOAK-5312
KEYCLOAK-5312 Add preview profile assumption to authz tests
This commit is contained in:
commit
9b858907ec
12 changed files with 50 additions and 10 deletions
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue