Merge pull request #4028 from mtrue01/pullmyothercodefinger
[KEYCLOAK-3964] NoImport Add coverage for basic test behavior
This commit is contained in:
commit
cf095766c7
1 changed files with 39 additions and 0 deletions
|
@ -211,6 +211,45 @@ public class LDAPProvidersIntegrationNoImportTest {
|
|||
oauth.openLogout();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testLDAPUserImportOnCreationOrLogin() {
|
||||
|
||||
KeycloakSession session = keycloakRule.startSession();
|
||||
RealmModel appRealm = new RealmManager(session).getRealmByName("test");
|
||||
LDAPStorageProvider ldapProvider = LDAPTestUtils.getLdapProvider(session, ldapModel);
|
||||
LDAPConfig config = ldapProvider.getLdapIdentityStore().getConfig();
|
||||
|
||||
// Make sure mary is gone
|
||||
LDAPTestUtils.removeLDAPUserByUsername(ldapProvider, appRealm, config, "maryjane");
|
||||
|
||||
|
||||
// Create the user in LDAP and register him
|
||||
//
|
||||
LDAPObject mary = LDAPTestUtils.addLDAPUser(ldapProvider, appRealm, "maryjane", "mary", "yram", "mj@testing.redhat.cz", null, "12398");
|
||||
LDAPTestUtils.updateLDAPPassword(ldapProvider, mary, "Password1");
|
||||
|
||||
try {
|
||||
|
||||
// Log in and out of the user
|
||||
loginSuccessAndLogout("maryjane", "Password1");
|
||||
|
||||
// Delete LDAP User
|
||||
LDAPTestUtils.removeLDAPUserByUsername(ldapProvider, appRealm, config, "maryjane");
|
||||
|
||||
// Make sure the deletion took place.
|
||||
List<UserModel> deletedUsers = session.users().searchForUser("mary yram", appRealm);
|
||||
Assert.assertTrue(deletedUsers.isEmpty());
|
||||
|
||||
} finally {
|
||||
keycloakRule.stopSession(session, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void caseInsensitiveSearch() {
|
||||
KeycloakSession session = keycloakRule.startSession();
|
||||
|
|
Loading…
Reference in a new issue