-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: authService만 사용하는 테스트를 AuthServiceTest로 이동
- Loading branch information
Showing
2 changed files
with
32 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
package edonymyeon.backend.auth.application; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.SoftAssertions.assertSoftly; | ||
import static org.awaitility.Awaitility.await; | ||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
import static org.mockito.Mockito.any; | ||
import static org.mockito.Mockito.atLeastOnce; | ||
import static org.mockito.Mockito.doNothing; | ||
import static org.mockito.Mockito.doThrow; | ||
import static org.mockito.Mockito.mock; | ||
import static org.mockito.Mockito.never; | ||
import static org.mockito.Mockito.verify; | ||
import static org.mockito.Mockito.when; | ||
|
||
import edonymyeon.backend.auth.application.dto.JoinRequest; | ||
import edonymyeon.backend.auth.application.dto.KakaoLoginResponse; | ||
import edonymyeon.backend.auth.application.dto.LoginRequest; | ||
|
@@ -32,9 +19,6 @@ | |
import edonymyeon.backend.setting.application.SettingService; | ||
import edonymyeon.backend.support.IntegrationTest; | ||
import jakarta.persistence.EntityManager; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
import lombok.RequiredArgsConstructor; | ||
import org.assertj.core.api.SoftAssertions; | ||
import org.junit.jupiter.api.DisplayNameGeneration; | ||
|
@@ -45,7 +29,16 @@ | |
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
import org.springframework.boot.test.mock.mockito.SpyBean; | ||
import org.springframework.test.context.jdbc.Sql; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatCode; | ||
import static org.assertj.core.api.SoftAssertions.assertSoftly; | ||
import static org.awaitility.Awaitility.await; | ||
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
import static org.mockito.Mockito.*; | ||
|
||
@DisplayNameGeneration(ReplaceUnderscores.class) | ||
@SuppressWarnings("NonAsciiCharacters") | ||
|
@@ -243,4 +236,18 @@ class AuthServiceTest { | |
} | ||
); | ||
} | ||
|
||
@Test | ||
void 동일한_디바이스_정보가_여러_회원에_걸쳐_존재할_때에도_로그아웃이_정상_동작해야_한다() { | ||
// Given : 회원이 새로 가입하여 로그인한 후 로그아웃한다. | ||
authService.joinMember(new JoinRequest(("[email protected]"), "password123!", "nickname", "sameDevice")); | ||
authService.login(new LoginRequest("[email protected]", "password123!", "sameDevice")); | ||
authService.logout("sameDevice"); | ||
|
||
// When : 동일한 디바이스를 가지고 새로운 회원이 가입하여 로그인한 후 로그아웃한다. | ||
authService.joinMember(new JoinRequest(("[email protected]"), "password123!", "nickname2", "sameDevice")); | ||
authService.login(new LoginRequest("[email protected]", "password123!", "sameDevice")); | ||
assertThatCode(() -> authService.logout("sameDevice")) | ||
.doesNotThrowAnyException(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,5 @@ | ||
package edonymyeon.backend.member.application; | ||
|
||
import static org.assertj.core.api.Assertions.*; | ||
import static org.assertj.core.api.SoftAssertions.assertSoftly; | ||
import static org.awaitility.Awaitility.await; | ||
import static org.mockito.Mockito.any; | ||
import static org.mockito.Mockito.atLeastOnce; | ||
import static org.mockito.Mockito.doThrow; | ||
import static org.mockito.Mockito.verify; | ||
|
||
import edonymyeon.backend.auth.application.AuthService; | ||
import edonymyeon.backend.auth.application.dto.JoinRequest; | ||
import edonymyeon.backend.auth.application.dto.KakaoLoginResponse; | ||
|
@@ -21,15 +13,21 @@ | |
import edonymyeon.backend.member.repository.MemberRepository; | ||
import edonymyeon.backend.post.ImageFileCleaner; | ||
import edonymyeon.backend.support.IntegrationFixture; | ||
import java.io.IOException; | ||
import lombok.RequiredArgsConstructor; | ||
import org.assertj.core.api.SoftAssertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.mock.mockito.SpyBean; | ||
import org.springframework.mock.web.MockMultipartFile; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.Assertions.assertThatThrownBy; | ||
import static org.assertj.core.api.SoftAssertions.assertSoftly; | ||
import static org.awaitility.Awaitility.await; | ||
import static org.mockito.Mockito.*; | ||
|
||
@SuppressWarnings("NonAsciiCharacters") | ||
@RequiredArgsConstructor | ||
class MemberServiceTest extends IntegrationFixture implements ImageFileCleaner { | ||
|
@@ -222,19 +220,4 @@ class MemberServiceTest extends IntegrationFixture implements ImageFileCleaner { | |
} | ||
); | ||
} | ||
|
||
@Test | ||
@DisplayName("동일한 디바이스 정보가 여러 회원에 걸쳐 존재할 때에도 로그아웃이 정상 동작해야 한다.") | ||
void deviceLogoutBug() { | ||
// Given : 회원이 새로 가입하여 로그인한 후 로그아웃한다. | ||
authService.joinMember(new JoinRequest(("[email protected]"), "password123!", "nickname", "sameDevice")); | ||
authService.login(new LoginRequest("[email protected]", "password123!", "sameDevice")); | ||
authService.logout("sameDevice"); | ||
|
||
// When : 동일한 디바이스를 가지고 새로운 회원이 가입하여 로그인한 후 로그아웃한다. | ||
authService.joinMember(new JoinRequest(("[email protected]"), "password123!", "nickname2", "sameDevice")); | ||
authService.login(new LoginRequest("[email protected]", "password123!", "sameDevice")); | ||
assertThatCode(() -> authService.logout("sameDevice")) | ||
.doesNotThrowAnyException(); | ||
} | ||
} |