Skip to content

Commit

Permalink
[test] : 로그아웃 시 기존 쿠키가 삭제되는지 검증 로직 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
dudxo committed Aug 19, 2024
1 parent 4e92ece commit 871106b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ void logout() {
Authentication authentication = new UsernamePasswordAuthenticationToken(principal, "test");

MockHttpServletRequest mockRequest = new MockHttpServletRequest();
MockHttpServletResponse mockResponse = new MockHttpServletResponse();
mockRequest.setCookies(new Cookie("Authorization", "testtesttesttest"));

given(cookieUtil.getCookieValue(mockRequest)).willReturn("testtesttesttest");
Expand All @@ -185,10 +186,11 @@ void logout() {
willDoNothing().given(redisUtil).setValues(anyString(), anyString(), any(Duration.class));

// when
LogoutResponse response = authService.logout(mockRequest);
LogoutResponse response = authService.logout(mockRequest, mockResponse);

// then
assertThat(response.result()).isTrue();
assertThat(mockResponse.getCookies()).isEmpty();
}

@DisplayName("refresh 토큰이 만료되지 않았다면 재발급 할 수 있다.")
Expand Down

0 comments on commit 871106b

Please sign in to comment.