Merge pull request #4028 from mtrue01/pullmyothercodefinger

[KEYCLOAK-3964] NoImport Add coverage for basic test behavior
This commit is contained in:
Bill Burke 2017-04-07 12:26:10 -04:00 committed by GitHub
commit cf095766c7

View file

@ -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();