use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class PasswordDaoImplTest method testCreateRestorationToken_expectDuplicateWillBeRewrittenWithoutErrors.
@Test
public void testCreateRestorationToken_expectDuplicateWillBeRewrittenWithoutErrors() throws Exception {
User createdUser = userService.createUser(UserFactory.createNewUserTemplate());
String pwd1 = "aaaa";
passwordService.setUserPassword(createdUser.getUuid(), pwd1);
String restorationToken = passwordService.getNewRestorationTokenForUser(createdUser.getUuid());
boolean result = passwordService.isRestorationTokenValid(createdUser.getUuid(), restorationToken);
assertTrue(result);
passwordService.deleteRestorationToken(createdUser.getUuid());
result = passwordService.isRestorationTokenValid(createdUser.getUuid(), restorationToken);
assertFalse(result);
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserCachedTest method testDeleteUser_expectUserNotFoundException.
// (expected=UserNotFoundException.class)
@Test
public void testDeleteUser_expectUserNotFoundException() throws Exception {
User userToCreate = UserFactory.createNewUserTemplate();
userToCreate = userService.createUser(userToCreate);
userService.getUserByUuid(userToCreate.getUuid());
userService.deleteUserByUuid(userToCreate.getUuid());
try {
userService.getUserByUuid(userToCreate.getUuid());
fail();
} catch (UserNotFoundException e) {
}
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserDaoImplTest method testCreateUser_expectUserWIllBeFoundByIdAfterCreateion.
@Test
public void testCreateUser_expectUserWIllBeFoundByIdAfterCreateion() throws Exception {
User userToCreate = UserFactory.createNewUserTemplate();
userToCreate = userService.createUser(userToCreate);
User foundUser = userService.getUserByUuid(userToCreate.getUuid());
assertNotNull(foundUser);
assertEquals(userToCreate.getDisplayName(), foundUser.getDisplayName());
assertEquals(userToCreate.getEmail(), foundUser.getEmail());
assertEquals(userToCreate.getIntegrationData(), foundUser.getIntegrationData());
assertEquals(userToCreate.getIsBlocked(), foundUser.getIsBlocked());
assertEquals(userToCreate.getLocale(), foundUser.getLocale());
assertEquals(userToCreate.getRegisteredAt(), foundUser.getRegisteredAt());
assertEquals(userToCreate.getTimeZone(), foundUser.getTimeZone());
assertEquals(userToCreate.getUuid(), foundUser.getUuid());
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserDaoImplTest method testCreateUser_expectUserWIllBeFoundByEmailAfterCreation.
@Test
public void testCreateUser_expectUserWIllBeFoundByEmailAfterCreation() throws Exception {
User userToCreate = UserFactory.createNewUserTemplate();
userToCreate = userService.createUser(userToCreate);
User foundUser = userService.getUserByEmail(userToCreate.getEmail());
assertNotNull(foundUser);
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserDaoImplTest method testFindUsersByDisplayNamePartial_expectCorrectSorting.
@Test
public // @Rollback(false)
void testFindUsersByDisplayNamePartial_expectCorrectSorting() throws Exception {
User user = UserFactory.createNewUserTemplate();
user.setDisplayName("ooUHapqoiwez");
user.setEmail("email2@aaa.ru");
userService.createUser(user);
user = UserFactory.createNewUserTemplate();
user.setDisplayName("oooUHapqoiwez");
user.setEmail("email3@aaa.ru");
userService.createUser(user);
user = UserFactory.createNewUserTemplate();
user.setDisplayName("oUHapqoiwez");
user.setEmail("email1@aaa.ru");
userService.createUser(user);
PaginatedList<User> results = userService.findUsersByDisplayNamePartial("UHapqoiwez", new PagerParams());
assertNotNull(results);
List<User> items = results.getItems();
assertNotNull(items);
assertTrue(items.size() == 3);
assertTrue(results.getTotalResults() == 3);
assertEquals("email1@aaa.ru", items.get(0).getEmail());
assertEquals("email2@aaa.ru", items.get(1).getEmail());
assertEquals("email3@aaa.ru", items.get(2).getEmail());
}
Aggregations