Search in sources :

Example 1 with AuthTokenService

use of org.summerb.microservices.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.microservices.users.api.AuthTokenService) Test(org.junit.Test)

Example 2 with AuthTokenService

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

the class AuthTokenServiceDbImplTest method testCreateAuthToken_blackbox_expectFieldValidationException.

@Test(expected = FieldValidationException.class)
public void testCreateAuthToken_blackbox_expectFieldValidationException() throws Exception {
    AuthTokenService fixture = AuthTokenServiceDbImplFactory.createAuthTokenServiceDbImpl();
    fixture.authenticate("abra cadabra", "", "");
    fail();
}
Also used : AuthTokenService(org.summerb.microservices.users.api.AuthTokenService) Test(org.junit.Test)

Example 3 with AuthTokenService

use of org.summerb.microservices.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.microservices.users.api.AuthTokenService) Test(org.junit.Test)

Example 4 with AuthTokenService

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

the class AuthTokenServiceDbImplTest method testCreateAuthToken_blackbox_expectUserNotFoundExpcetion.

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

Example 5 with AuthTokenService

use of org.summerb.microservices.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.microservices.users.api.dto.AuthToken) AuthTokenService(org.summerb.microservices.users.api.AuthTokenService) Test(org.junit.Test)

Aggregations

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