Search in sources :

Example 6 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testCreateAuthToken_blackbox_expectInvalidPasswordException.

@Test(expected = InvalidPasswordException.class)
public void testCreateAuthToken_blackbox_expectInvalidPasswordException() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.authenticate(UserFactory.EXISTENT_USER_EMAIL, UUID.randomUUID().toString(), "");
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 7 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testCreateAuthToken_blackbox_expectNewAuthToken.

@Test
public void testCreateAuthToken_blackbox_expectNewAuthToken() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    AuthToken result = fixture.authenticate(UserFactory.EXISTENT_USER_EMAIL, PasswordFactory.RIGHT_PASSWORD_FOR_EXISTENT_USER, "0.0.0.0");
    assertNotNull(result);
}
Also used : AuthToken(org.summerb.users.api.dto.AuthToken) AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 8 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testCreateAuthToken_whitebox_expectUserServiceUnexpectedExceptionOnDaoFail.

@Test(expected = UserServiceUnexpectedException.class)
public void testCreateAuthToken_whitebox_expectUserServiceUnexpectedExceptionOnDaoFail() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.authenticate(UserFactory.USER_EMAIL_RESULT_IN_EXCEPTION, "", "0.0.0.0");
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 9 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testCreateAuthToken_defensive_userNull.

@Test(expected = IllegalArgumentException.class)
public void testCreateAuthToken_defensive_userNull() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.authenticate(null, "", "");
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Example 10 with AuthTokenService

use of org.summerb.users.api.AuthTokenService in project summerb by skarpushin.

the class AuthTokenServiceDbImplTest method testFindUserAuthTokens_whitebox_expectUnexpectedException.

@Test(expected = UserServiceUnexpectedException.class)
public void testFindUserAuthTokens_whitebox_expectUnexpectedException() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.findUserAuthTokens(UserFactory.USER_RESULT_IN_EXCEPTION);
    fail();
}
Also used : AuthTokenService(org.summerb.users.api.AuthTokenService) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)11 AuthTokenService (org.summerb.users.api.AuthTokenService)11 AuthToken (org.summerb.users.api.dto.AuthToken)1