[KEYCLOAK-3964] NoImport Add coverage for basic test behavior

This commit is contained in:
Mark True 2017-04-07 10:37:02 -04:00
parent 0db2640076
commit 4daafa56fc

View file

@ -211,6 +211,45 @@ public class LDAPProvidersIntegrationNoImportTest {
oauth.openLogout(); 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 @Test
public void caseInsensitiveSearch() { public void caseInsensitiveSearch() {
KeycloakSession session = keycloakRule.startSession(); KeycloakSession session = keycloakRule.startSession();