From f96c3312e2d583c4f456ee457cd2ffe42c23e010 Mon Sep 17 00:00:00 2001 From: Pedro Igor Date: Wed, 15 Nov 2017 10:26:32 -0200 Subject: [PATCH] [KEYCLOAK-5841] - Test --- .../testsuite/admin/FineGrainAdminUnitTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java index 5e9a47322b..7c4314ab34 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/admin/FineGrainAdminUnitTest.java @@ -16,6 +16,7 @@ */ package org.keycloak.testsuite.admin; +import org.apache.directory.api.ldap.aci.UserPermission; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.shrinkwrap.api.spec.WebArchive; import org.junit.Assert; @@ -715,13 +716,14 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest { management.roles().setPermissionsEnabled(removedClientRole, true); management.groups().setPermissionsEnabled(removedGroup, true); management.clients().setPermissionsEnabled(client, true); + management.users().setPermissionsEnabled(true); } public static void invokeDelete(KeycloakSession session) { RealmModel realm = session.realms().getRealmByName(TEST); AdminPermissionManagement management = AdminPermissions.management(session, realm); List byResourceServer = management.authz().getStoreFactory().getResourceStore().findByResourceServer(management.realmResourceServer().getId()); - Assert.assertEquals(4, byResourceServer.size()); + Assert.assertEquals(5, byResourceServer.size()); RoleModel removedRole = realm.getRole("removedRole"); realm.removeRole(removedRole); ClientModel client = realm.getClientByClientId("removedClient"); @@ -730,9 +732,14 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest { GroupModel group = KeycloakModelUtils.findGroupByPath(realm, "removedGroup"); realm.removeGroup(group); byResourceServer = management.authz().getStoreFactory().getResourceStore().findByResourceServer(management.realmResourceServer().getId()); - Assert.assertEquals(1, byResourceServer.size()); + Assert.assertEquals(2, byResourceServer.size()); realm.removeClient(client.getId()); byResourceServer = management.authz().getStoreFactory().getResourceStore().findByResourceServer(management.realmResourceServer().getId()); + Assert.assertEquals(1, byResourceServer.size()); + management.users().setPermissionsEnabled(false); + Resource userResource = management.authz().getStoreFactory().getResourceStore().findByName("Users", management.realmResourceServer().getId()); + Assert.assertNull(userResource); + byResourceServer = management.authz().getStoreFactory().getResourceStore().findByResourceServer(management.realmResourceServer().getId()); Assert.assertEquals(0, byResourceServer.size()); }