use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class SocialServiceIntTest method testCreateSocialUserShouldCreateSocialConnection.
@Test
public void testCreateSocialUserShouldCreateSocialConnection() {
// Setup
Connection<?> connection = createConnection("@LOGIN", "mail@mail.com", "FIRST_NAME", "LAST_NAME", "IMAGE_URL", "PROVIDER");
// Exercise
socialService.createSocialUser(connection, "fr");
// Verify
verify(mockConnectionRepository, times(1)).addConnection(connection);
// Teardown
User userToDelete = userRepository.findOneByEmailIgnoreCase("mail@mail.com").get();
userRepository.delete(userToDelete);
}
use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class SocialServiceIntTest method testCreateSocialUserShouldThrowExceptionIfConnectionHasNoEmailAndLoginAlreadyExist.
@Test(expected = IllegalArgumentException.class)
public void testCreateSocialUserShouldThrowExceptionIfConnectionHasNoEmailAndLoginAlreadyExist() {
// Setup
User user = createExistingUser("@LOGIN", "mail@mail.com", "OTHER_FIRST_NAME", "OTHER_LAST_NAME", "OTHER_IMAGE_URL");
Connection<?> connection = createConnection("@LOGIN", "", "FIRST_NAME", "LAST_NAME", "IMAGE_URL", "PROVIDER");
// Exercise
try {
// Exercise
socialService.createSocialUser(connection, "fr");
} finally {
// Teardown
userRepository.delete(user);
}
}
use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class SocialServiceIntTest method testCreateSocialUserShouldCreateUserWithExactLangKey.
@Test
public void testCreateSocialUserShouldCreateUserWithExactLangKey() {
// Setup
Connection<?> connection = createConnection("@LOGIN", "mail@mail.com", "FIRST_NAME", "LAST_NAME", "IMAGE_URL", "PROVIDER");
// Exercise
socialService.createSocialUser(connection, "fr");
// Verify
final User user = userRepository.findOneByEmailIgnoreCase("mail@mail.com").get();
assertThat(user.getLangKey()).isEqualTo("fr");
// Teardown
userRepository.delete(user);
}
use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class UserServiceIntTest method init.
@Before
public void init() {
user = new User();
user.setLogin("johndoe");
user.setPassword(RandomStringUtils.random(60));
user.setActivated(true);
user.setEmail("johndoe@localhost");
user.setFirstName("john");
user.setLastName("doe");
user.setImageUrl("http://placehold.it/50x50");
user.setLangKey("en");
}
use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class UserServiceIntTest method assertThatResetKeyMustBeValid.
@Test
@Transactional
public void assertThatResetKeyMustBeValid() {
Instant daysAgo = Instant.now().minus(25, ChronoUnit.HOURS);
user.setActivated(true);
user.setResetDate(daysAgo);
user.setResetKey("1234");
userRepository.saveAndFlush(user);
Optional<User> maybeUser = userService.completePasswordReset("johndoe2", user.getResetKey());
assertThat(maybeUser).isNotPresent();
userRepository.delete(user);
}
Aggregations