use of org.olat.core.id.User in project OpenOLAT by OpenOLAT.
the class ShibbolethAttributesTest method shouldReturnFalseIfNoAttributeHasChanged.
@Test
public void shouldReturnFalseIfNoAttributeHasChanged() {
User user = getIdenticalOlatUser();
boolean hasDifference = sut.hasDifference(user);
assertThat(hasDifference).isFalse();
}
use of org.olat.core.id.User in project OpenOLAT by OpenOLAT.
the class ShibbolethAttributesTest method shouldChangeChangedPropertyOfSyncedUser.
@Test
public void shouldChangeChangedPropertyOfSyncedUser() {
User user = getIdenticalOlatUser();
user.setProperty(USER_NAME_KEY, USER_OLD_VALUE);
User syncedUser = sut.syncUser(user);
assertThat(syncedUser.getProperty(USER_CITY_KEY, null)).isEqualTo(SHIB_CITY_VALUE_NULL);
}
use of org.olat.core.id.User in project OpenOLAT by OpenOLAT.
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);
}
use of org.olat.core.id.User in project OpenOLAT by OpenOLAT.
the class UserManagerImplTest method shouldAllowEmailIfItsOwnEmail.
@Test
public void shouldAllowEmailIfItsOwnEmail() {
when(userModuleMock.isEmailUnique()).thenReturn(true);
when(userModuleMock.isEmailMandatory()).thenReturn(true);
User myselfMock = mock(User.class);
when(myselfMock.getEmail()).thenReturn(DUPLICATE_EMAIL);
boolean isEmailAllowed = sut.isEmailAllowed(DUPLICATE_EMAIL, myselfMock);
assertThat(isEmailAllowed).isTrue();
}
use of org.olat.core.id.User in project OpenOLAT by OpenOLAT.
the class UserManagerImplTest method shouldEnsureEmailIfHasNoEmail.
@Test
public void shouldEnsureEmailIfHasNoEmail() {
Long userKey = 123l;
String issuer = "issuer";
AuthenticationProvider authenticationProviderMock = mock(AuthenticationProvider.class);
when(authenticationProviderMock.getIssuerIdentifier(any())).thenReturn(issuer);
when(loginModuleMock.getAuthenticationProvider("OLAT")).thenReturn(authenticationProviderMock);
User userWithoutEmailMock = mock(User.class);
when(userWithoutEmailMock.getKey()).thenReturn(userKey);
String ensuredEmail = sut.getEnsuredEmail(userWithoutEmailMock);
String expectedValue = userKey + "@" + issuer;
assertThat(ensuredEmail).isEqualTo(expectedValue);
}
Aggregations