use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class SocialServiceIntTest method testCreateSocialUserShouldCreateActivatedUserWithRoleUserAndPassword.
@Test
public void testCreateSocialUserShouldCreateActivatedUserWithRoleUserAndPassword() {
// Setup
Connection<?> connection = createConnection("@LOGIN", "mail@mail.com", "FIRST_NAME", "LAST_NAME", "IMAGE_URL", "PROVIDER");
// Exercise
socialService.createSocialUser(connection, "fr");
// Verify
User user = userRepository.findOneByEmailIgnoreCase("mail@mail.com").get();
assertThat(user.getActivated()).isEqualTo(true);
assertThat(user.getPassword()).isNotEmpty();
Authority userAuthority = authorityRepository.findOne(AuthoritiesConstants.USER);
assertThat(user.getAuthorities().toArray()).containsExactly(userAuthority);
// Teardown
userRepository.delete(user);
}
use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class SocialServiceIntTest method testCreateSocialUserShouldSendRegistrationValidationEmail.
@Test
public void testCreateSocialUserShouldSendRegistrationValidationEmail() {
// Setup
Connection<?> connection = createConnection("@LOGIN", "mail@mail.com", "FIRST_NAME", "LAST_NAME", "IMAGE_URL", "PROVIDER");
// Exercise
socialService.createSocialUser(connection, "fr");
// Verify
verify(mockMailService, times(1)).sendSocialRegistrationValidationEmail(anyObject(), anyString());
// 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 createExistingUser.
private User createExistingUser(String login, String email, String firstName, String lastName, String imageUrl) {
User user = new User();
user.setLogin(login);
user.setPassword(passwordEncoder.encode("password"));
user.setEmail(email);
user.setFirstName(firstName);
user.setLastName(lastName);
user.setImageUrl(imageUrl);
return userRepository.saveAndFlush(user);
}
use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class SocialServiceIntTest method testCreateSocialUserShouldCreateUserWithSocialLoginWhenIsTwitter.
@Test
public void testCreateSocialUserShouldCreateUserWithSocialLoginWhenIsTwitter() {
// Setup
Connection<?> connection = createConnection("@LOGIN", "mail@mail.com", "FIRST_NAME", "LAST_NAME", "IMAGE_URL", "twitter");
// Exercise
socialService.createSocialUser(connection, "fr");
// Verify
User user = userRepository.findOneByEmailIgnoreCase("mail@mail.com").get();
assertThat(user.getLogin()).isEqualToIgnoringCase("@LOGIN");
// Teardown
userRepository.delete(user);
}
use of com.furyviewer.domain.User in project FuryViewer by TheDoctor-95.
the class SocialServiceIntTest method testCreateSocialUserShouldCreateUserWithLoginSameAsEmailIfNotTwitter.
@Test
public void testCreateSocialUserShouldCreateUserWithLoginSameAsEmailIfNotTwitter() {
// Setup
Connection<?> connection = createConnection("@LOGIN", "mail@mail.com", "FIRST_NAME", "LAST_NAME", "IMAGE_URL", "PROVIDER_OTHER_THAN_TWITTER");
// Exercise
socialService.createSocialUser(connection, "fr");
// Verify
User user = userRepository.findOneByEmailIgnoreCase("mail@mail.com").get();
assertThat(user.getLogin()).isEqualTo("mail@mail.com");
// Teardown
userRepository.delete(user);
}
Aggregations