cleanup test
This commit is contained in:
parent
8993ca08ad
commit
75d517a1e8
1 changed files with 15 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.keycloak.testsuite.migration;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.keycloak.representations.idm.ClientRepresentation;
|
||||
import org.keycloak.representations.idm.GroupRepresentation;
|
||||
|
@ -31,6 +32,7 @@ import static org.keycloak.testsuite.auth.page.AuthRealm.MASTER;
|
|||
*/
|
||||
public abstract class AbstractJsonFileImportMigrationTest extends AbstractMigrationTest {
|
||||
protected RealmRepresentation masterRep;
|
||||
protected String masterTestClientId;
|
||||
|
||||
@Before
|
||||
public void beforeMigrationTest() {
|
||||
|
@ -41,7 +43,8 @@ public abstract class AbstractJsonFileImportMigrationTest extends AbstractMigrat
|
|||
|
||||
|
||||
|
||||
// hack to reuse AbstractMigrationTest
|
||||
// hack to reuse AbstractMigrationTest need to create a bunch of stuff in master realm for tests to work
|
||||
|
||||
RoleRepresentation newRole = new RoleRepresentation();
|
||||
newRole.setName("master-test-realm-role");
|
||||
|
||||
|
@ -62,4 +65,15 @@ public abstract class AbstractJsonFileImportMigrationTest extends AbstractMigrat
|
|||
if (!user.getUsername().equals("admin")) masterRealm.users().create(user);
|
||||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public void afterMigrationTest() {
|
||||
masterRealm.clients().get(masterTestClientId).remove();
|
||||
masterRealm.roles().get("master-test-realm-role").remove();
|
||||
GroupRepresentation group = masterRealm.getGroupByPath("/migration-test-group");
|
||||
masterRealm.groups().group(group.getId()).remove();
|
||||
UserRepresentation user = masterRealm.users().search("master-test-user").get(0);
|
||||
masterRealm.users().get(user.getId()).remove();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue