-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from cvs-go/feature#121
회원 탈퇴 API 수정
- Loading branch information
Showing
13 changed files
with
128 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.cvsgo.config; | ||
|
||
import com.cvsgo.service.UserService; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.scheduling.annotation.EnableScheduling; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
|
||
@RequiredArgsConstructor | ||
@EnableScheduling | ||
@Configuration | ||
public class SchedulerConfig { | ||
|
||
private final UserService userService; | ||
|
||
@Scheduled(cron = "0 0 0 * * *", zone = "Asia/Seoul") | ||
public void deleteUserId() { | ||
userService.deleteUserId(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,19 +134,19 @@ void respond_400_when_login_but_user_does_not_exist() throws Exception { | |
} | ||
|
||
@Test | ||
@DisplayName("탈퇴한 계정이면 로그인 API 호출시 HTTP 400를 응답한다") | ||
void respond_400_when_login_but_user_is_deleted() throws Exception { | ||
@DisplayName("탈퇴한 계정이면 로그인 API 호출시 HTTP 403를 응답한다") | ||
void respond_403_when_login_but_user_is_deleted() throws Exception { | ||
LoginRequestDto loginRequestDto = LoginRequestDto.builder() | ||
.email("[email protected]") | ||
.password("password1!") | ||
.build(); | ||
|
||
given(authService.login(any())).willThrow(ExceptionConstants.NOT_FOUND_USER); | ||
given(authService.login(any())).willThrow(ExceptionConstants.FORBIDDEN_USER); | ||
|
||
mockMvc.perform(post("/api/auth/login") | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.content(objectMapper.writeValueAsString(loginRequestDto))) | ||
.andExpect(status().isNotFound()) | ||
.andExpect(status().isForbidden()) | ||
.andDo(print()); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import com.cvsgo.dto.auth.TokenDto; | ||
import com.cvsgo.entity.RefreshToken; | ||
import com.cvsgo.entity.User; | ||
import com.cvsgo.exception.ForbiddenException; | ||
import com.cvsgo.exception.NotFoundException; | ||
import com.cvsgo.exception.UnauthorizedException; | ||
import com.cvsgo.repository.RefreshTokenRepository; | ||
|
@@ -95,7 +96,7 @@ void should_throw_NotFoundException_when_user_tries_to_login_but_user_does_not_e | |
} | ||
|
||
@Test | ||
@DisplayName("탈퇴한 사용자이면 NotFoundException이 발생한다") | ||
@DisplayName("탈퇴한 사용자이면 ForbiddenException이 발생한다") | ||
void should_throw_NotFoundException_when_user_tries_to_login_but_user_is_deleted() { | ||
LoginRequestDto loginRequestDto = LoginRequestDto.builder() | ||
.email("[email protected]") | ||
|
@@ -110,7 +111,7 @@ void should_throw_NotFoundException_when_user_tries_to_login_but_user_is_deleted | |
given(userRepository.findByUserId(loginRequestDto.getEmail())) | ||
.willReturn(Optional.of(user)); | ||
|
||
assertThrows(NotFoundException.class, () -> authService.login(loginRequestDto)); | ||
assertThrows(ForbiddenException.class, () -> authService.login(loginRequestDto)); | ||
|
||
then(userRepository).should(times(1)).findByUserId(any()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters