-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] E4-S3 회원가입 API - 회원가입 API주소 수정 #25
- Loading branch information
1 parent
b2d719d
commit fe87bc0
Showing
2 changed files
with
56 additions
and
1 deletion.
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
55 changes: 55 additions & 0 deletions
55
backend/src/test/java/com/infp/ciat/user/controller/AccountControllerTest.java
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,55 @@ | ||
package com.infp.ciat.user.controller; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.infp.ciat.user.controller.dto.request.SignupRequestDTO; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.web.servlet.MockMvc; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print; | ||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; | ||
|
||
@ActiveProfiles("test") | ||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) | ||
@AutoConfigureMockMvc | ||
class AccountControllerTest { | ||
@Autowired | ||
private MockMvc mockMvc; | ||
|
||
@Test | ||
@DisplayName("회원가입") | ||
public void SignUp() throws Exception { | ||
SignupRequestDTO signup_requestdto1 = create_signup_requestdto("test1@test.com", "test1", "password"); | ||
|
||
mockMvc.perform( | ||
post("/signup") | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.content(new ObjectMapper().writeValueAsString(signup_requestdto1)) | ||
) | ||
.andExpect(status().isCreated()) | ||
.andDo(print()); | ||
} | ||
|
||
/*** | ||
* 회원가입 요청 DTO 생성 | ||
* @param email | ||
* @param nickname | ||
* @param password | ||
* @return | ||
*/ | ||
private SignupRequestDTO create_signup_requestdto(String email, String nickname, String password) { | ||
SignupRequestDTO signupRequestDTO = new SignupRequestDTO(); | ||
signupRequestDTO.setEmail(email); | ||
signupRequestDTO.setNickname(nickname); | ||
signupRequestDTO.setPassword(password); | ||
|
||
return signupRequestDTO; | ||
} | ||
} |