use of org.summerb.users.api.dto.User in project summerb by skarpushin.
the class AuthTokenDaoImplTest method testUpdateUserPassword_expectWillReportAffectedRecords.
@Test
public void testUpdateUserPassword_expectWillReportAffectedRecords() throws Exception {
User user = userService.createUser(UserFactory.createNewUserTemplate());
passwordService.setUserPassword(user.getUuid(), "aaa");
int result = passwordDao.updateUserPassword(user.getUuid(), "new-hash");
assertTrue(result > 0);
// do the same. Still expect affected > 0
result = passwordDao.updateUserPassword(user.getUuid(), "new-hash");
assertTrue(result > 0);
}
use of org.summerb.users.api.dto.User in project summerb by skarpushin.
the class AuthTokenDaoImplTest method testSetRestorationToken_expectWillReportAffectedRecords.
@Test
public void testSetRestorationToken_expectWillReportAffectedRecords() throws Exception {
User user = userService.createUser(UserFactory.createNewUserTemplate());
passwordService.setUserPassword(user.getUuid(), "aaa");
int result = passwordDao.setRestorationToken(user.getUuid(), "new-hash");
assertTrue(result > 0);
// do the same. Still expect affected > 0
result = passwordDao.setRestorationToken(user.getUuid(), "new-hash");
assertTrue(result > 0);
}
use of org.summerb.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.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.users.api.dto.User in project summerb by skarpushin.
the class UserDaoImplTest method testUpdateUser_expectChangedValueAfterUpdate.
@Test
public void testUpdateUser_expectChangedValueAfterUpdate() throws Exception {
User userToCreate = UserFactory.createNewUserTemplate();
userToCreate.setDisplayName("old display name");
userToCreate = userService.createUser(userToCreate);
userToCreate.setDisplayName("new display name");
userService.updateUser(userToCreate);
User foundUser = userService.getUserByUuid(userToCreate.getUuid());
assertEquals(userToCreate.getDisplayName(), foundUser.getDisplayName());
}
Aggregations