From 8c93fdfb62261ed8175ce0ed708843b81bb14687 Mon Sep 17 00:00:00 2001 From: Bill Burke Date: Mon, 31 Jul 2017 13:01:23 -0400 Subject: [PATCH] fix test --- .../admin/FineGrainAdminUnitTest.java | 58 +++++++++++-------- 1 file changed, 34 insertions(+), 24 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 8bfc9561f4..5e9a47322b 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 @@ -766,21 +766,26 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest { ClientRepresentation newClient = new ClientRepresentation(); - newClient.setName("newClient"); - newClient.setClientId("newClient"); - newClient.setFullScopeAllowed(true); - newClient.setSecret("secret"); - newClient.setProtocol("openid-connect"); - newClient.setPublicClient(false); - newClient.setEnabled(true); - Response response = realmClient.realm("anotherRealm").clients().create(newClient); - Assert.assertEquals(403, response.getStatus()); + try { + newClient.setName("newClient"); + newClient.setClientId("newClient"); + newClient.setFullScopeAllowed(true); + newClient.setSecret("secret"); + newClient.setProtocol("openid-connect"); + newClient.setPublicClient(false); + newClient.setEnabled(true); + Response response = realmClient.realm("anotherRealm").clients().create(newClient); + Assert.assertEquals(403, response.getStatus()); - realmClient.close(); - realmClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), - "master", "admin", "admin", "fullScopedClient", "618268aa-51e6-4e64-93c4-3c0bc65b8171"); - response = realmClient.realm("anotherRealm").clients().create(newClient); - Assert.assertEquals(201, response.getStatus()); + realmClient.close(); + realmClient = AdminClientUtil.createAdminClient(suiteContext.isAdapterCompatTesting(), + "master", "admin", "admin", "fullScopedClient", "618268aa-51e6-4e64-93c4-3c0bc65b8171"); + response = realmClient.realm("anotherRealm").clients().create(newClient); + Assert.assertEquals(201, response.getStatus()); + } finally { + adminClient.realm("anotherRealm").remove(); + + } } @@ -804,17 +809,22 @@ public class FineGrainAdminUnitTest extends AbstractKeycloakTest { newRealm.setEnabled(true); adminClient.realms().create(newRealm); - ClientRepresentation newClient = new ClientRepresentation(); + try { + ClientRepresentation newClient = new ClientRepresentation(); - newClient.setName("newClient"); - newClient.setClientId("newClient"); - newClient.setFullScopeAllowed(true); - newClient.setSecret("secret"); - newClient.setProtocol("openid-connect"); - newClient.setPublicClient(false); - newClient.setEnabled(true); - Response response = adminClient.realm("anotherRealm").clients().create(newClient); - Assert.assertEquals(201, response.getStatus()); + newClient.setName("newClient"); + newClient.setClientId("newClient"); + newClient.setFullScopeAllowed(true); + newClient.setSecret("secret"); + newClient.setProtocol("openid-connect"); + newClient.setPublicClient(false); + newClient.setEnabled(true); + Response response = adminClient.realm("anotherRealm").clients().create(newClient); + Assert.assertEquals(201, response.getStatus()); + } finally { + adminClient.realm("anotherRealm").remove(); + + } }