From a10f0823924803c16c2a8f8b0f7653b7bc6c0866 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=8B=A0=EC=B0=AC=EA=B7=9C=28Shin=20Changyu=29?= <63400830+scv1702@users.noreply.github.com> Date: Tue, 9 Jul 2024 16:55:21 +0900 Subject: [PATCH] =?UTF-8?q?GETP-145=20test:=20=ED=9A=8C=EC=9B=90=20?= =?UTF-8?q?=EA=B0=80=EC=9E=85=20=EC=8B=9C=20=EC=9D=B4=EB=A9=94=EC=9D=BC=20?= =?UTF-8?q?=EC=9D=B8=EC=A6=9D=20=EC=BD=94=EB=93=9C=20=EC=A0=84=EC=86=A1=20?= =?UTF-8?q?=EC=BB=A8=ED=8A=B8=EB=A1=A4=EB=9F=AC=20=EB=8B=A8=EC=9C=84=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EB=B0=8F=20API=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=20=EC=9E=91=EC=84=B1=20(#70)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...d-email-verification-code-for-sign-up.adoc | 1 + src/docs/asciidoc/index.adoc | 1 + .../auth/controller/SignUpControllerTest.java | 22 +++++++++++++++++++ .../domain/auth/support/SignUpFixture.java | 5 +++++ 4 files changed, 29 insertions(+) create mode 100644 src/docs/asciidoc/auth/send-email-verification-code-for-sign-up.adoc diff --git a/src/docs/asciidoc/auth/send-email-verification-code-for-sign-up.adoc b/src/docs/asciidoc/auth/send-email-verification-code-for-sign-up.adoc new file mode 100644 index 00000000..2e297715 --- /dev/null +++ b/src/docs/asciidoc/auth/send-email-verification-code-for-sign-up.adoc @@ -0,0 +1 @@ +operation::send-email-verification-code-for-sign-up/send-email-verification-code-for-sign-up[snippets="http-request,http-response"] \ No newline at end of file diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc index ac1a020f..9dfbe584 100644 --- a/src/docs/asciidoc/index.adoc +++ b/src/docs/asciidoc/index.adoc @@ -18,6 +18,7 @@ include::{docdir}/auth/signup.adoc[] include::{docdir}/auth/login.adoc[] === 회원 가입 시 이메일 인증 코드 전송 +include::{docdir}/auth/send-email-verification-code-for-sign-up.adoc[] === Access Token 및 Refresh Token 재발급 include::{docdir}/auth/reissue-access-token.adoc[] diff --git a/src/test/java/es/princip/getp/domain/auth/controller/SignUpControllerTest.java b/src/test/java/es/princip/getp/domain/auth/controller/SignUpControllerTest.java index 0732326c..6c78127c 100644 --- a/src/test/java/es/princip/getp/domain/auth/controller/SignUpControllerTest.java +++ b/src/test/java/es/princip/getp/domain/auth/controller/SignUpControllerTest.java @@ -1,5 +1,6 @@ package es.princip.getp.domain.auth.controller; +import es.princip.getp.domain.auth.dto.request.EmailVerificationCodeRequest; import es.princip.getp.domain.auth.dto.request.SignUpRequest; import es.princip.getp.domain.auth.exception.SignUpErrorCode; import es.princip.getp.domain.auth.service.SignUpService; @@ -33,6 +34,27 @@ public class SignUpControllerTest extends AbstractControllerTest { @MockBean private SignUpService signUpService; + @Nested + @DisplayName("사용자는") + class SendEmailVerificationCodeForSignUp { + + @DisplayName("회원 가입 시 이메일 인증을 해야 한다.") + @Test + void sendEmailVerificationCodeForSignUp() throws Exception { + mockMvc.perform(post("/auth/signup/email/send") + .content(objectMapper.writeValueAsString(SignUpFixture.createEmailVerificationCodeRequest()))) + .andExpect(status().isOk()) + .andDo( + restDocs.document( + requestFields( + getDescriptor("email", "이메일", EmailVerificationCodeRequest.class) + ) + ) + ) + .andDo(print()); + } + } + @Nested @DisplayName("사용자는") class SignUp { diff --git a/src/test/java/es/princip/getp/domain/auth/support/SignUpFixture.java b/src/test/java/es/princip/getp/domain/auth/support/SignUpFixture.java index 76594784..43a13a3c 100644 --- a/src/test/java/es/princip/getp/domain/auth/support/SignUpFixture.java +++ b/src/test/java/es/princip/getp/domain/auth/support/SignUpFixture.java @@ -1,5 +1,6 @@ package es.princip.getp.domain.auth.support; +import es.princip.getp.domain.auth.dto.request.EmailVerificationCodeRequest; import es.princip.getp.domain.auth.dto.request.SignUpRequest; import es.princip.getp.domain.auth.dto.response.SignUpResponse; import es.princip.getp.domain.member.domain.enums.MemberType; @@ -44,4 +45,8 @@ public static SignUpResponse toSignUpResponse(final SignUpRequest request) { request.memberType() ); } + + public static EmailVerificationCodeRequest createEmailVerificationCodeRequest() { + return new EmailVerificationCodeRequest(EMAIL); + } }