Skip to content

Commit 6f70531

Browse files
committed
Ref: API 경로 개선
1 parent c4579e6 commit 6f70531

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/main/java/com/back/domain/user/controller/AuthController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public ResponseEntity<RsData<UserResponse>> register(
3535
}
3636

3737
// 이메일 인증
38-
@GetMapping("/email-verification")
38+
@GetMapping("/email/verify")
3939
public ResponseEntity<RsData<UserResponse>> verifyEmail(
4040
@RequestParam("token") String token
4141
) {
@@ -48,7 +48,7 @@ public ResponseEntity<RsData<UserResponse>> verifyEmail(
4848
}
4949

5050
// 인증 메일 재발송
51-
@PostMapping("/email-verification/resend")
51+
@PostMapping("/email/verify")
5252
public ResponseEntity<RsData<Void>> resendVerificationEmail(
5353
@Valid @RequestBody ResendVerificationRequest request
5454
) {

src/test/java/com/back/domain/user/controller/AuthControllerTest.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ void verifyEmail_success() throws Exception {
240240
String token = tokenService.createEmailVerificationToken(saved.getId());
241241

242242
// when & then
243-
mvc.perform(get("/api/auth/email-verification").param("token", token))
243+
mvc.perform(get("/api/auth/email/verify").param("token", token))
244244
.andDo(print())
245245
.andExpect(status().isOk())
246246
.andExpect(jsonPath("$.success").value(true))
@@ -254,7 +254,7 @@ void verifyEmail_success() throws Exception {
254254
@Test
255255
@DisplayName("유효하지 않거나 만료된 토큰 → 401 Unauthorized")
256256
void verifyEmail_invalidOrExpiredToken() throws Exception {
257-
mvc.perform(get("/api/auth/email-verification").param("token", "fake-token"))
257+
mvc.perform(get("/api/auth/email/verify").param("token", "fake-token"))
258258
.andDo(print())
259259
.andExpect(status().isUnauthorized())
260260
.andExpect(jsonPath("$.success").value(false))
@@ -276,7 +276,7 @@ void verifyEmail_alreadyVerified() throws Exception {
276276
String token = tokenService.createEmailVerificationToken(saved.getId());
277277

278278
// when & then
279-
mvc.perform(get("/api/auth/email-verification").param("token", token))
279+
mvc.perform(get("/api/auth/email/verify").param("token", token))
280280
.andDo(print())
281281
.andExpect(status().isConflict())
282282
.andExpect(jsonPath("$.success").value(false))
@@ -287,7 +287,7 @@ void verifyEmail_alreadyVerified() throws Exception {
287287
@Test
288288
@DisplayName("토큰 파라미터 누락 → 400 Bad Request")
289289
void verifyEmail_missingToken() throws Exception {
290-
mvc.perform(get("/api/auth/email-verification"))
290+
mvc.perform(get("/api/auth/email/verify"))
291291
.andDo(print())
292292
.andExpect(status().isBadRequest())
293293
.andExpect(jsonPath("$.success").value(false))
@@ -314,7 +314,7 @@ void resendVerificationEmail_success() throws Exception {
314314
""";
315315

316316
// when & then
317-
mvc.perform(post("/api/auth/email-verification/resend")
317+
mvc.perform(post("/api/auth/email/verify")
318318
.contentType(MediaType.APPLICATION_JSON)
319319
.content(body))
320320
.andDo(print())
@@ -334,7 +334,7 @@ void resendVerificationEmail_userNotFound() throws Exception {
334334
}
335335
""";
336336

337-
mvc.perform(post("/api/auth/email-verification/resend")
337+
mvc.perform(post("/api/auth/email/verify")
338338
.contentType(MediaType.APPLICATION_JSON)
339339
.content(body))
340340
.andDo(print())
@@ -360,7 +360,7 @@ void resendVerificationEmail_alreadyVerified() throws Exception {
360360
}
361361
""";
362362

363-
mvc.perform(post("/api/auth/email-verification/resend")
363+
mvc.perform(post("/api/auth/email/verify")
364364
.contentType(MediaType.APPLICATION_JSON)
365365
.content(body))
366366
.andDo(print())
@@ -379,7 +379,7 @@ void resendVerificationEmail_missingField() throws Exception {
379379
}
380380
""";
381381

382-
mvc.perform(post("/api/auth/email-verification/resend")
382+
mvc.perform(post("/api/auth/email/verify")
383383
.contentType(MediaType.APPLICATION_JSON)
384384
.content(body))
385385
.andDo(print())

0 commit comments

Comments
 (0)