Search in sources :

Example 76 with User

use of org.olat.core.id.User in project openolat by klemens.

the class ShibbolethAttributesTest method shouldChangePropertyOfSyncedUserIfItWasNotPresent.

@Test
public void shouldChangePropertyOfSyncedUserIfItWasNotPresent() {
    User user = getIdenticalOlatUser();
    user.setProperty(USER_NAME_KEY, null);
    User syncedUser = sut.syncUser(user);
    assertThat(syncedUser.getProperty(USER_CITY_KEY, null)).isEqualTo(SHIB_CITY_VALUE_NULL);
}
Also used : User(org.olat.core.id.User) Test(org.junit.Test)

Example 77 with User

use of org.olat.core.id.User in project openolat by klemens.

the class ShibbolethAttributesTest method shouldNotChangeProperyOfSyncedUserIfSameValue.

@Test
public void shouldNotChangeProperyOfSyncedUserIfSameValue() {
    User user = getIdenticalOlatUser();
    User syncedUser = sut.syncUser(user);
    assertThat(syncedUser.getProperty(USER_EMAIL_KEY, null)).isEqualTo(SHIB_EMAIL_VALUE);
}
Also used : User(org.olat.core.id.User) Test(org.junit.Test)

Example 78 with User

use of org.olat.core.id.User in project openolat by klemens.

the class ShibbolethAttributesTest method shouldReturnTrueIfOneAttributeHaveChanged.

@Test
public void shouldReturnTrueIfOneAttributeHaveChanged() {
    User user = getIdenticalOlatUser();
    when(differenceCheckerMock.isDifferent(SHIB_NAME_KEY, SHIB_NAME_VALUE, SHIB_NAME_VALUE)).thenReturn(true);
    boolean hasDifference = sut.hasDifference(user);
    assertThat(hasDifference).isTrue();
}
Also used : User(org.olat.core.id.User) Test(org.junit.Test)

Example 79 with User

use of org.olat.core.id.User in project openolat by klemens.

the class ShibbolethAttributesTest method shouldReturnFalseIfNoAttributeHasChanged.

@Test
public void shouldReturnFalseIfNoAttributeHasChanged() {
    User user = getIdenticalOlatUser();
    boolean hasDifference = sut.hasDifference(user);
    assertThat(hasDifference).isFalse();
}
Also used : User(org.olat.core.id.User) Test(org.junit.Test)

Example 80 with User

use of org.olat.core.id.User in project openolat by klemens.

the class ShibbolethAttributesTest method shouldRemovePropertyFromSyncedUserIfNotPresentInShibboleth.

@Test
public void shouldRemovePropertyFromSyncedUserIfNotPresentInShibboleth() {
    User user = getIdenticalOlatUser();
    user.setProperty(USER_CITY_KEY, USER_OLD_VALUE);
    when(differenceCheckerMock.isDifferent(SHIB_CITY_KEY, SHIB_CITY_VALUE_NULL, USER_OLD_VALUE)).thenReturn(true);
    User syncedUser = sut.syncUser(user);
    assertThat(syncedUser.getProperty(USER_CITY_KEY, null)).isEqualTo(SHIB_CITY_VALUE_NULL);
}
Also used : User(org.olat.core.id.User) Test(org.junit.Test)

Aggregations

User (org.olat.core.id.User)260 Identity (org.olat.core.id.Identity)126 Test (org.junit.Test)82 UserPropertyHandler (org.olat.user.propertyhandlers.UserPropertyHandler)52 HashMap (java.util.HashMap)28 Translator (org.olat.core.gui.translator.Translator)26 SecurityGroup (org.olat.basesecurity.SecurityGroup)20 Date (java.util.Date)18 ArrayList (java.util.ArrayList)16 Locale (java.util.Locale)16 FormItem (org.olat.core.gui.components.form.flexible.FormItem)16 File (java.io.File)14 VelocityContext (org.apache.velocity.VelocityContext)14 MailTemplate (org.olat.core.util.mail.MailTemplate)12 LDAPUser (org.olat.ldap.model.LDAPUser)12 UserManager (org.olat.user.UserManager)12 IOException (java.io.IOException)10 Map (java.util.Map)10 List (java.util.List)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8