-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] 테스트 코드 리팩토링 #730
base: develop
Are you sure you want to change the base?
[BE] 테스트 코드 리팩토링 #730
Changes from 1 commit
bc56f07
c209ebd
1fa27ea
3a2aca5
9c296bc
4b08854
431ad83
81f6419
13bb5a6
bc6e3bf
2a90fdf
5d0cb9a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -53,7 +53,6 @@ | |||||
@SpringBootTest | ||||||
@AutoConfigureMockMvc | ||||||
@Transactional | ||||||
@Disabled("무중단 배포를 위한 API 버저닝으로 인한 임시 disabled") | ||||||
class AcceptanceTest { | ||||||
|
||||||
@MockBean | ||||||
|
@@ -131,7 +130,7 @@ void setUp() { | |||||
.parseSubject(로그인_정보.tokenResponse().accessToken(), tokenConfig.secretKey())); | ||||||
|
||||||
MvcResult result = mockMvc.perform( | ||||||
get("/api/studies") | ||||||
get("/api/v2/studies") | ||||||
.param("memberId", String.valueOf(memberId)) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
.andExpect(status().isOk()) | ||||||
|
@@ -145,7 +144,7 @@ void setUp() { | |||||
} | ||||||
|
||||||
private LoginResponse 비회원_로그인을_진행한다() throws Exception { | ||||||
MvcResult result = mockMvc.perform(post("/api/auth/guest")) | ||||||
MvcResult result = mockMvc.perform(post("/api/v2/auth/guest")) | ||||||
.andExpect(status().isOk()) | ||||||
.andReturn(); | ||||||
|
||||||
|
@@ -166,7 +165,7 @@ void setUp() { | |||||
"mock-picture")); | ||||||
|
||||||
MvcResult result = mockMvc.perform( | ||||||
post("/api/auth/login") | ||||||
post("/api/v2/auth/login") | ||||||
.contentType(MediaType.APPLICATION_JSON) | ||||||
.content(jsonRequest)) | ||||||
.andExpect(status().isOk()) | ||||||
|
@@ -182,7 +181,7 @@ void setUp() { | |||||
CreateStudyRequest request = new CreateStudyRequest("studyName", 1, 20); | ||||||
String jsonRequest = objectMapper.writeValueAsString(request); | ||||||
MvcResult result = mockMvc.perform( | ||||||
post("/api/studies") | ||||||
post("/api/v2/studies") | ||||||
.contentType(MediaType.APPLICATION_JSON) | ||||||
.content(jsonRequest) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
|
@@ -192,7 +191,7 @@ void setUp() { | |||||
|
||||||
String[] parsed = locationHeader.split("/"); | ||||||
System.out.println(locationHeader); | ||||||
return Long.parseLong(parsed[3]); | ||||||
return Long.parseLong(parsed[4]); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분은 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
코테풀 때 사용하는 코드 스타일이기는 한데 지금처럼 하드 코딩하는 것보단 나을 것 같아서 제안드려봐요...! |
||||||
} | ||||||
|
||||||
private Long 스터디에_참여한다(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { | ||||||
|
@@ -202,7 +201,7 @@ void setUp() { | |||||
String jsonRequest = objectMapper.writeValueAsString(request); | ||||||
|
||||||
MvcResult result = mockMvc.perform( | ||||||
post("/api/studies/{studyId}/participants", 스터디_아이디) | ||||||
post("/api/v2/studies/{studyId}/participants", 스터디_아이디) | ||||||
.contentType(MediaType.APPLICATION_JSON) | ||||||
.content(jsonRequest) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
|
@@ -220,7 +219,7 @@ void setUp() { | |||||
WritePlanRequest request = new WritePlanRequest(참여자_아이디, Map.of("plan", "test")); | ||||||
String jsonRequest = objectMapper.writeValueAsString(request); | ||||||
|
||||||
mockMvc.perform(post("/api/studies/{studyId}/contents/write-plan", 스터디_아이디) | ||||||
mockMvc.perform(post("/api/v2/studies/{studyId}/contents/write-plan", 스터디_아이디) | ||||||
.contentType(MediaType.APPLICATION_JSON) | ||||||
.content(jsonRequest) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
|
@@ -229,7 +228,7 @@ void setUp() { | |||||
|
||||||
private void 스터디_상태를_다음_단계로_넘긴다(LoginResponse 로그인_정보, Long 스터디_아이디) | ||||||
throws Exception { | ||||||
mockMvc.perform(post("/api/studies/{studyId}/next-step", 스터디_아이디) | ||||||
mockMvc.perform(post("/api/v2/studies/{studyId}/next-step", 스터디_아이디) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
.andExpect(status().isNoContent()); | ||||||
} | ||||||
|
@@ -239,7 +238,7 @@ void setUp() { | |||||
Map.of("retrospect", "test")); | ||||||
String jsonRequest = objectMapper.writeValueAsString(request); | ||||||
|
||||||
mockMvc.perform(post("/api/studies/{studyId}/contents/write-retrospect", | ||||||
mockMvc.perform(post("/api/v2/studies/{studyId}/contents/write-retrospect", | ||||||
스터디_아이디) | ||||||
.contentType(MediaType.APPLICATION_JSON) | ||||||
.content(jsonRequest) | ||||||
|
@@ -248,7 +247,7 @@ void setUp() { | |||||
} | ||||||
|
||||||
private void 스터디_종료_후_결과_조회(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { | ||||||
MvcResult result = mockMvc.perform(get("/api/studies/{studyId}/participants", 스터디_아이디) | ||||||
MvcResult result = mockMvc.perform(get("/api/v2/studies/{studyId}/participants", 스터디_아이디) | ||||||
.accept(MediaType.APPLICATION_JSON) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
.andExpect(status().isOk()) | ||||||
|
@@ -268,7 +267,7 @@ void setUp() { | |||||
} | ||||||
|
||||||
private String 스터디_아이디로_참여_코드를_얻는다(LoginResponse 로그인_정보, Long 스터디_아이디) throws Exception { | ||||||
MvcResult result = mockMvc.perform(get("/api/participant-codes") | ||||||
MvcResult result = mockMvc.perform(get("/api/v2/participant-codes") | ||||||
.param("studyId", 스터디_아이디.toString()) | ||||||
.accept(MediaType.APPLICATION_JSON) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
|
@@ -284,7 +283,7 @@ void setUp() { | |||||
} | ||||||
|
||||||
private void 참여_코드로_스터디_아이디를_얻는다(LoginResponse 로그인_정보, String 참여_코드) throws Exception { | ||||||
MvcResult result = mockMvc.perform(get("/api/studies") | ||||||
MvcResult result = mockMvc.perform(get("/api/v2/studies") | ||||||
.param("participantCode", 참여_코드) | ||||||
.accept(MediaType.APPLICATION_JSON) | ||||||
.header(HttpHeaders.AUTHORIZATION, 로그인_정보.createAuthorizationHeader())) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이거 버저닝 걷어내고 살렸으면 작업량이 줄어드셨을텐데... 고생 많으셨어요 😭