Skip to content

Commit ea4e313

Browse files
committed
test[jwt]: 요청 api url 변경 반영
1 parent ee4b8eb commit ea4e313

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

backend/src/test/java/com/ai/lawyer/domain/member/controller/MemberControllerTest.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ void resetPassword_Success_WithLoginIdInBody() throws Exception {
506506
doNothing().when(memberService).resetPassword("[email protected]", "newPassword123", true);
507507

508508
// when and then
509-
mockMvc.perform(post("/api/auth/password-reset/reset")
509+
mockMvc.perform(post("/api/auth/passwordReset")
510510
.with(csrf())
511511
.contentType(MediaType.APPLICATION_JSON)
512512
.content(objectMapper.writeValueAsString(requestDto)))
@@ -517,6 +517,7 @@ void resetPassword_Success_WithLoginIdInBody() throws Exception {
517517
.andExpect(jsonPath("$.success").value(true));
518518

519519
verify(memberService).resetPassword("[email protected]", "newPassword123", true);
520+
verify(memberService).logout("[email protected]", any());
520521
}
521522

522523
@Test
@@ -532,14 +533,15 @@ void resetPassword_Fail_NotAuthenticated() throws Exception {
532533
.when(memberService).resetPassword("[email protected]", "newPassword123", false);
533534

534535
// when and then
535-
mockMvc.perform(post("/api/auth/password-reset/reset")
536+
mockMvc.perform(post("/api/auth/passwordReset")
536537
.with(csrf())
537538
.contentType(MediaType.APPLICATION_JSON)
538539
.content(objectMapper.writeValueAsString(requestDto)))
539540
.andDo(print())
540541
.andExpect(status().isBadRequest());
541542

542543
verify(memberService).resetPassword("[email protected]", "newPassword123", false);
544+
verify(memberService, never()).logout(anyString(), any());
543545
}
544546

545547
@Test
@@ -555,34 +557,36 @@ void resetPassword_Fail_MemberNotFound() throws Exception {
555557
.when(memberService).resetPassword("[email protected]", "newPassword123", true);
556558

557559
// when and then
558-
mockMvc.perform(post("/api/auth/password-reset/reset")
560+
mockMvc.perform(post("/api/auth/passwordReset")
559561
.with(csrf())
560562
.contentType(MediaType.APPLICATION_JSON)
561563
.content(objectMapper.writeValueAsString(requestDto)))
562564
.andDo(print())
563565
.andExpect(status().isUnauthorized());
564566

565567
verify(memberService).resetPassword("[email protected]", "newPassword123", true);
568+
verify(memberService, never()).logout(anyString(), any());
566569
}
567570

568571
@Test
569-
@DisplayName("비밀번호 재설정 성공 - 토큰 없이 loginId만으로")
570-
void resetPassword_Success_WithoutToken() throws Exception {
572+
@DisplayName("비밀번호 재설정 실패 - loginId 없음")
573+
void resetPassword_Fail_NoLoginId() throws Exception {
571574
// given - loginId 없이 요청
572575
ResetPasswordRequestDto requestDto = new ResetPasswordRequestDto();
573576
requestDto.setNewPassword("newPassword123");
574577
requestDto.setSuccess(true);
575578
// loginId는 설정하지 않음
576579

577580
// when and then - loginId가 없으면 예외가 발생해야 함
578-
mockMvc.perform(post("/api/auth/password-reset/reset")
581+
mockMvc.perform(post("/api/auth/passwordReset")
579582
.with(csrf())
580583
.contentType(MediaType.APPLICATION_JSON)
581584
.content(objectMapper.writeValueAsString(requestDto)))
582585
.andDo(print())
583586
.andExpect(status().isBadRequest());
584587

585588
verify(memberService, never()).resetPassword(anyString(), anyString(), any());
589+
verify(memberService, never()).logout(anyString(), any());
586590
}
587591

588592
@Test
@@ -595,14 +599,15 @@ void resetPassword_Fail_ValidationError() throws Exception {
595599
invalidRequest.setSuccess(null); // null success
596600

597601
// when and then
598-
mockMvc.perform(post("/api/auth/password-reset/reset")
602+
mockMvc.perform(post("/api/auth/passwordReset")
599603
.with(csrf())
600604
.contentType(MediaType.APPLICATION_JSON)
601605
.content(objectMapper.writeValueAsString(invalidRequest)))
602606
.andDo(print())
603607
.andExpect(status().isBadRequest());
604608

605609
verify(memberService, never()).resetPassword(anyString(), anyString(), any());
610+
verify(memberService, never()).logout(anyString(), any());
606611
}
607612

608613
@Test

0 commit comments

Comments
 (0)