use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class AuthTokenDaoImplTest method testUpdateToken_expectValueWillBeUpdated.
@Test
public void testUpdateToken_expectValueWillBeUpdated() throws Exception {
User user = userService.createUser(UserFactory.createNewUserTemplate());
passwordService.setUserPassword(user.getUuid(), "aaa");
AuthToken authToken = authTokenService.createAuthToken(user.getEmail(), "LOCAL", "tUuid1", "tValue1");
assertNotNull(authToken);
authTokenDao.updateToken(authToken.getUuid(), new Date().getTime() + 1, "newValue2");
authToken = authTokenService.getAuthTokenByUuid(authToken.getUuid());
assertEquals("newValue2", authToken.getTokenValue());
}
use of org.summerb.microservices.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.microservices.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.microservices.users.api.dto.User in project summerb by skarpushin.
the class PasswordDaoImplTest method testSetUserPassword_expectDuplicateWillBeRewrittenWithoutErrors.
@Test
public void testSetUserPassword_expectDuplicateWillBeRewrittenWithoutErrors() throws Exception {
User createdUser = userService.createUser(UserFactory.createNewUserTemplate());
String pwd1 = "aaaa";
passwordService.setUserPassword(createdUser.getUuid(), pwd1);
String pwd2 = "bbbb";
passwordService.setUserPassword(createdUser.getUuid(), pwd2);
boolean result = passwordService.isUserPasswordValid(createdUser.getUuid(), pwd2);
assertTrue(result);
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class PasswordDaoImplTest method testSetUserPassword_expectWillBePerformedOk.
@Test
public void testSetUserPassword_expectWillBePerformedOk() throws Exception {
User createdUser = userService.createUser(UserFactory.createNewUserTemplate());
String pwd1 = "aaaa";
passwordService.setUserPassword(createdUser.getUuid(), pwd1);
boolean result = passwordService.isUserPasswordValid(createdUser.getUuid(), pwd1);
assertTrue(result);
}
Aggregations