use of org.summerb.microservices.users.api.dto.AuthToken in project summerb by skarpushin.
the class AuthTokenServiceDbImplTest method testGetAuthTokenByUuid_blackbox_expectOk.
@Test
public void testGetAuthTokenByUuid_blackbox_expectOk() throws Exception {
AuthTokenServiceImpl fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
AuthToken result = fixture.getAuthTokenByUuid(AuthTokenFactory.AUTH_TOKEN_EXISTENT);
assertNotNull(result);
}
use of org.summerb.microservices.users.api.dto.AuthToken in project summerb by skarpushin.
the class AuthTokenDaoImplTest method testIsAuthTokenValid_expectWillNotUpdateLastVerifiedForOldValue.
@Test
public void testIsAuthTokenValid_expectWillNotUpdateLastVerifiedForOldValue() throws Exception {
User user = userService.createUser(UserFactory.createNewUserTemplate());
passwordService.setUserPassword(user.getUuid(), "aaa");
AuthToken authToken = authTokenService.authenticate(user.getEmail(), "aaa", "LOCAL");
assertNotNull(authToken);
authTokenDao.updateToken(authToken.getUuid(), 5, null);
authToken = authTokenService.getAuthTokenByUuid(authToken.getUuid());
assertTrue(authToken.getLastVerifiedAt() > 5);
}
use of org.summerb.microservices.users.api.dto.AuthToken in project summerb by skarpushin.
the class AuthTokenDaoImplTest method testIsAuthTokenValid_expectTokenMustBeValidRightAfterCreation.
@Test
public void testIsAuthTokenValid_expectTokenMustBeValidRightAfterCreation() throws Exception {
User user = userService.createUser(UserFactory.createNewUserTemplate());
passwordService.setUserPassword(user.getUuid(), "aaa");
AuthToken authToken = authTokenService.authenticate(user.getEmail(), "aaa", "LOCAL");
assertNotNull(authToken);
AuthToken result = authTokenService.isAuthTokenValid(user.getUuid(), authToken.getUuid(), authToken.getTokenValue());
assertNotNull(result);
}
Aggregations