LDAPSyncTest - additional removal of users at the end of the test
Necessary when running with external AD Closes #27499 Signed-off-by: Pavel Drozd <pdrozd@redhat.com>
This commit is contained in:
parent
bba701437f
commit
be7775a9be
1 changed files with 10 additions and 0 deletions
|
@ -346,6 +346,16 @@ public class LDAPSyncTest extends AbstractLDAPTest {
|
|||
Assert.assertEquals("user1", user1.getFirstAttribute(LDAPConstants.LDAP_ID));
|
||||
});
|
||||
|
||||
// Remove all users from model - required step before the next test execution especially when running against external AD
|
||||
testingClient.server().run(session -> {
|
||||
LDAPTestContext ctx = LDAPTestContext.init(session);
|
||||
// Remove all users from model
|
||||
UserStoragePrivateUtil.userLocalStorage(session)
|
||||
.searchForUserStream(ctx.getRealm(), Collections.emptyMap())
|
||||
.collect(Collectors.toList())
|
||||
.forEach(user -> UserStoragePrivateUtil.userLocalStorage(session).removeUser(ctx.getRealm(), user));
|
||||
});
|
||||
|
||||
// Revert config changes
|
||||
ComponentRepresentation ldapRep = testRealm().components().component(ldapModelId).toRepresentation();
|
||||
ldapRep.getConfig().putSingle(LDAPConstants.UUID_LDAP_ATTRIBUTE, origUuidAttrName);
|
||||
|
|
Loading…
Reference in a new issue