From 96ac64162e06ced85bc930d97083663509504875 Mon Sep 17 00:00:00 2001 From: yujamint Date: Thu, 25 Jul 2024 23:11:59 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20FakeLoginController=20=EB=B9=88=20?= =?UTF-8?q?=EC=A4=91=EB=B3=B5=20=EC=83=9D=EC=84=B1=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../category/CategoryIntegrationTest.java | 2 +- .../integration/dto/FakeSignUpRequest.java | 17 -------- .../fake/FakeSignUpController.java | 40 ------------------- .../integration/file/FileIntegrationTest.java | 2 +- .../AiGeneratedProblemIntegrationTest.java | 2 +- .../CategorizedProblemIntegrationTest.java | 2 +- .../MemberSavedProblemIntegrationTest.java | 2 +- .../ProblemFileIntegrationTest.java | 2 +- .../AiGeneratedSummaryIntegrationTest.java | 2 +- .../CategorizedSummaryIntegrationTest.java | 2 +- .../MemberSavedSummaryIntegrationTest.java | 2 +- .../SummaryFileIntegrationTest.java | 2 +- 12 files changed, 10 insertions(+), 67 deletions(-) delete mode 100644 src/test/java/com/app/integration/dto/FakeSignUpRequest.java delete mode 100644 src/test/java/com/app/integration/fake/FakeSignUpController.java diff --git a/src/test/java/com/app/integration/category/CategoryIntegrationTest.java b/src/test/java/com/app/integration/category/CategoryIntegrationTest.java index 02ef5f7..45d8b7a 100644 --- a/src/test/java/com/app/integration/category/CategoryIntegrationTest.java +++ b/src/test/java/com/app/integration/category/CategoryIntegrationTest.java @@ -5,7 +5,7 @@ import com.app.domain.category.dto.CategoryDto; import com.app.domain.category.dto.CategoryDto.RequestDto; import com.app.domain.category.contsant.CategoryType; -import com.app.integration.dto.FakeSignUpRequest; +import com.app.fake.FakeSignUpRequest; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/src/test/java/com/app/integration/dto/FakeSignUpRequest.java b/src/test/java/com/app/integration/dto/FakeSignUpRequest.java deleted file mode 100644 index 26fc84e..0000000 --- a/src/test/java/com/app/integration/dto/FakeSignUpRequest.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.app.integration.dto; - -import lombok.Builder; -import lombok.Getter; - -@Getter -@Builder -public class FakeSignUpRequest { - - private String nickname; - private String email; - - public FakeSignUpRequest(String nickname, String email) { - this.nickname = nickname; - this.email = email; - } -} diff --git a/src/test/java/com/app/integration/fake/FakeSignUpController.java b/src/test/java/com/app/integration/fake/FakeSignUpController.java deleted file mode 100644 index 6e5003c..0000000 --- a/src/test/java/com/app/integration/fake/FakeSignUpController.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.app.integration.fake; - -import com.app.domain.member.constant.MemberType; -import com.app.domain.member.constant.Role; -import com.app.domain.member.entity.Member; -import com.app.domain.member.service.MemberService; -import com.app.global.jwt.dto.JwtTokenDto; -import com.app.global.jwt.service.TokenManager; -import com.app.integration.dto.FakeSignUpRequest; -import lombok.RequiredArgsConstructor; -import org.springframework.context.annotation.Profile; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; - -@RequiredArgsConstructor -@Profile(value = {"local", "test"}) -@RestController -public class FakeSignUpController { - - private final MemberService memberService; - private final TokenManager tokenManager; - - @PostMapping("/api/fake/login") - public ResponseEntity fakeSignUp(@RequestBody FakeSignUpRequest request) { - Member member = memberService.findMemberByEmail(request.getEmail()).orElseGet( - () -> memberService.registerMember(Member.builder() - .nickName(request.getNickname()) - .email(request.getEmail()) - .memberType(MemberType.KAKAO) - .role(Role.USER) - .build()) - ); - - JwtTokenDto jwtTokenDto = tokenManager.createJwtTokenDto(member.getMemberId(), member.getRole()); - member.updateRefreshToken(jwtTokenDto); - return ResponseEntity.ok(jwtTokenDto.getAccessToken()); - } -} diff --git a/src/test/java/com/app/integration/file/FileIntegrationTest.java b/src/test/java/com/app/integration/file/FileIntegrationTest.java index e388ad6..780e6dd 100644 --- a/src/test/java/com/app/integration/file/FileIntegrationTest.java +++ b/src/test/java/com/app/integration/file/FileIntegrationTest.java @@ -11,8 +11,8 @@ import com.app.domain.problem.aigeneratedproblem.repository.ProblemFileRepository; import com.app.domain.summary.aigeneratedsummary.entity.SummaryFile; import com.app.domain.summary.aigeneratedsummary.repository.SummaryFileRepository; +import com.app.fake.FakeSignUpRequest; import com.app.global.config.ENUM.PdfType; -import com.app.integration.dto.FakeSignUpRequest; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/src/test/java/com/app/integration/problem/aigeneratedproblem/AiGeneratedProblemIntegrationTest.java b/src/test/java/com/app/integration/problem/aigeneratedproblem/AiGeneratedProblemIntegrationTest.java index 3ce5711..82b23e7 100644 --- a/src/test/java/com/app/integration/problem/aigeneratedproblem/AiGeneratedProblemIntegrationTest.java +++ b/src/test/java/com/app/integration/problem/aigeneratedproblem/AiGeneratedProblemIntegrationTest.java @@ -5,8 +5,8 @@ import com.app.domain.problem.aigeneratedproblem.repository.AiGeneratedProblemRepository; import com.app.domain.problem.aigeneratedproblem.repository.ProblemFileRepository; import com.app.domain.problem.aigeneratedproblem.service.AiGeneratedProblemService; +import com.app.fake.FakeSignUpRequest; import com.app.global.config.ENUM.ProblemType; -import com.app.integration.dto.FakeSignUpRequest; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/src/test/java/com/app/integration/problem/categorizedproblem/CategorizedProblemIntegrationTest.java b/src/test/java/com/app/integration/problem/categorizedproblem/CategorizedProblemIntegrationTest.java index 9a156a5..69396de 100644 --- a/src/test/java/com/app/integration/problem/categorizedproblem/CategorizedProblemIntegrationTest.java +++ b/src/test/java/com/app/integration/problem/categorizedproblem/CategorizedProblemIntegrationTest.java @@ -4,8 +4,8 @@ import com.app.domain.category.contsant.CategoryType; import com.app.domain.category.dto.CategoryDto.RequestDto; +import com.app.fake.FakeSignUpRequest; import com.app.global.config.ENUM.ProblemType; -import com.app.integration.dto.FakeSignUpRequest; import com.app.domain.categorizedproblem.dto.CategorizedProblemDto; import com.app.domain.problem.membersavedproblem.dto.MemberSavedProblemDto; import io.restassured.RestAssured; diff --git a/src/test/java/com/app/integration/problem/membersavedproblem/MemberSavedProblemIntegrationTest.java b/src/test/java/com/app/integration/problem/membersavedproblem/MemberSavedProblemIntegrationTest.java index 3b5011b..1d60ac8 100644 --- a/src/test/java/com/app/integration/problem/membersavedproblem/MemberSavedProblemIntegrationTest.java +++ b/src/test/java/com/app/integration/problem/membersavedproblem/MemberSavedProblemIntegrationTest.java @@ -2,8 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; +import com.app.fake.FakeSignUpRequest; import com.app.global.config.ENUM.ProblemType; -import com.app.integration.dto.FakeSignUpRequest; import com.app.domain.problem.membersavedproblem.dto.MemberSavedProblemDto; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; diff --git a/src/test/java/com/app/integration/problemfile/ProblemFileIntegrationTest.java b/src/test/java/com/app/integration/problemfile/ProblemFileIntegrationTest.java index aa32936..b53e3b2 100644 --- a/src/test/java/com/app/integration/problemfile/ProblemFileIntegrationTest.java +++ b/src/test/java/com/app/integration/problemfile/ProblemFileIntegrationTest.java @@ -1,11 +1,11 @@ package com.app.integration.problemfile; import com.app.domain.problem.aigeneratedproblem.dto.ProblemFile.Request.AiGenerateProblemDto; +import com.app.fake.FakeSignUpRequest; import com.app.global.config.ENUM.Amount; import com.app.global.config.ENUM.ProblemDifficulty; import com.app.global.config.ENUM.ProblemType; import com.app.global.config.S3.S3Service; -import com.app.integration.dto.FakeSignUpRequest; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/src/test/java/com/app/integration/summary/aigeneratedsummary/AiGeneratedSummaryIntegrationTest.java b/src/test/java/com/app/integration/summary/aigeneratedsummary/AiGeneratedSummaryIntegrationTest.java index 20526a5..b3cb84c 100644 --- a/src/test/java/com/app/integration/summary/aigeneratedsummary/AiGeneratedSummaryIntegrationTest.java +++ b/src/test/java/com/app/integration/summary/aigeneratedsummary/AiGeneratedSummaryIntegrationTest.java @@ -3,7 +3,7 @@ import com.app.domain.summary.aigeneratedsummary.entity.AiGeneratedSummary; import com.app.domain.summary.aigeneratedsummary.entity.SummaryFile; import com.app.domain.summary.aigeneratedsummary.service.AiGeneratedSummaryService; -import com.app.integration.dto.FakeSignUpRequest; +import com.app.fake.FakeSignUpRequest; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/src/test/java/com/app/integration/summary/categorizedsummary/CategorizedSummaryIntegrationTest.java b/src/test/java/com/app/integration/summary/categorizedsummary/CategorizedSummaryIntegrationTest.java index 194caea..a28d37e 100644 --- a/src/test/java/com/app/integration/summary/categorizedsummary/CategorizedSummaryIntegrationTest.java +++ b/src/test/java/com/app/integration/summary/categorizedsummary/CategorizedSummaryIntegrationTest.java @@ -5,8 +5,8 @@ import com.app.domain.category.contsant.CategoryType; import com.app.domain.category.dto.CategoryDto.RequestDto; import com.app.domain.summary.membersavedsummary.dto.MemberSavedSummaryDto; +import com.app.fake.FakeSignUpRequest; import com.app.global.config.ENUM.ProblemType; -import com.app.integration.dto.FakeSignUpRequest; import com.app.domain.categorizedsummary.dto.CategorizedSummaryDto; import com.app.domain.summary.dto.SummaryDto; import io.restassured.RestAssured; diff --git a/src/test/java/com/app/integration/summary/membersavedsummary/MemberSavedSummaryIntegrationTest.java b/src/test/java/com/app/integration/summary/membersavedsummary/MemberSavedSummaryIntegrationTest.java index 6d367d8..42c2a58 100644 --- a/src/test/java/com/app/integration/summary/membersavedsummary/MemberSavedSummaryIntegrationTest.java +++ b/src/test/java/com/app/integration/summary/membersavedsummary/MemberSavedSummaryIntegrationTest.java @@ -2,8 +2,8 @@ import static org.assertj.core.api.Assertions.assertThat; -import com.app.integration.dto.FakeSignUpRequest; import com.app.domain.summary.membersavedsummary.dto.MemberSavedSummaryDto; +import com.app.fake.FakeSignUpRequest; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse; import io.restassured.response.Response; diff --git a/src/test/java/com/app/integration/summaryfile/aigeneratedsummary/SummaryFileIntegrationTest.java b/src/test/java/com/app/integration/summaryfile/aigeneratedsummary/SummaryFileIntegrationTest.java index 4397bbb..f95f189 100644 --- a/src/test/java/com/app/integration/summaryfile/aigeneratedsummary/SummaryFileIntegrationTest.java +++ b/src/test/java/com/app/integration/summaryfile/aigeneratedsummary/SummaryFileIntegrationTest.java @@ -3,9 +3,9 @@ import com.app.domain.file.dto.Response.FileListResponseDto; import com.app.domain.summary.aigeneratedsummary.dto.SummaryFile.Request.AiGenerateSummaryDto; import com.app.domain.summary.aigeneratedsummary.dto.SummaryFile.Response.AiGenerateSummaryResponseDto; +import com.app.fake.FakeSignUpRequest; import com.app.global.config.ENUM.Amount; import com.app.global.config.S3.S3Service; -import com.app.integration.dto.FakeSignUpRequest; import com.jayway.jsonpath.TypeRef; import io.restassured.RestAssured; import io.restassured.response.ExtractableResponse;