Search in sources :

Example 61 with User

use of com.aidanwhiteley.books.domain.User in project books by aidanwhiteley.

the class UserServiceTest method testUpdateFacebookBasedUser.

@Test
void testUpdateFacebookBasedUser() {
    User user = testUserCreate(facebookClientClientId, NEW_USER_2, User.AuthenticationProvider.FACEBOOK);
    configureOauth(facebookClientClientId, UPDATED_USER_2);
    UserService userService = configureUserService();
    User updatedUser = userService.createOrUpdateUser(oauthToken);
    assertEquals(UPDATED_USER_2, updatedUser.getFullName());
    // Check that the user was updated and not created again
    assertEquals(user.getId(), updatedUser.getId());
}
Also used : User(com.aidanwhiteley.books.domain.User) DefaultOAuth2User(org.springframework.security.oauth2.core.user.DefaultOAuth2User) OAuth2User(org.springframework.security.oauth2.core.user.OAuth2User) Test(org.junit.jupiter.api.Test) IntegrationTest(com.aidanwhiteley.books.util.IntegrationTest)

Aggregations

User (com.aidanwhiteley.books.domain.User)61 Test (org.junit.jupiter.api.Test)35 Book (com.aidanwhiteley.books.domain.Book)25 IntegrationTest (com.aidanwhiteley.books.util.IntegrationTest)24 BookRepositoryTest (com.aidanwhiteley.books.repository.BookRepositoryTest)13 URI (java.net.URI)5 DefaultOAuth2User (org.springframework.security.oauth2.core.user.DefaultOAuth2User)4 OAuth2User (org.springframework.security.oauth2.core.user.OAuth2User)4 Principal (java.security.Principal)3 HttpHeaders (org.springframework.http.HttpHeaders)3 Comment (com.aidanwhiteley.books.domain.Comment)2 Around (org.aspectj.lang.annotation.Around)2 LoggerContext (ch.qos.logback.classic.LoggerContext)1 ClientRoles (com.aidanwhiteley.books.controller.dtos.ClientRoles)1 NotAuthorisedException (com.aidanwhiteley.books.controller.exceptions.NotAuthorisedException)1 Owner (com.aidanwhiteley.books.domain.Owner)1 Item (com.aidanwhiteley.books.domain.googlebooks.Item)1 Claims (io.jsonwebtoken.Claims)1 ExpiredJwtException (io.jsonwebtoken.ExpiredJwtException)1 LocalDateTime (java.time.LocalDateTime)1