From 948240fd03d1b50c8679652522027444d9f07bf4 Mon Sep 17 00:00:00 2001 From: HeoSeokMun Date: Sun, 17 Dec 2023 15:47:20 +0900 Subject: [PATCH] =?UTF-8?q?test:=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/UpdateFemaleTest.kt | 95 ------------------- ...pdateMaleTest.kt => UpdateUserInfoTest.kt} | 41 ++------ 2 files changed, 7 insertions(+), 129 deletions(-) delete mode 100644 src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateFemaleTest.kt rename src/test/kotlin/com/yourssu/ssudateserver/controller/{UpdateMaleTest.kt => UpdateUserInfoTest.kt} (59%) diff --git a/src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateFemaleTest.kt b/src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateFemaleTest.kt deleted file mode 100644 index f8a0a4d..0000000 --- a/src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateFemaleTest.kt +++ /dev/null @@ -1,95 +0,0 @@ -package com.yourssu.ssudateserver.controller - -import com.yourssu.ssudateserver.common.BaseTest -import com.yourssu.ssudateserver.dto.request.UpdateFemaleRequestDto -import com.yourssu.ssudateserver.enums.FemaleAnimals -import com.yourssu.ssudateserver.enums.MBTI -import com.yourssu.ssudateserver.fixture.PrincipalFixture.Companion.setPrincipal -import org.junit.jupiter.api.Test -import org.springframework.http.MediaType -import org.springframework.test.context.ActiveProfiles -import org.springframework.test.web.servlet.patch - -@ActiveProfiles("test") -class UpdateFemaleTest : BaseTest() { - - @Test - fun updateMaleTest() { - setPrincipal("oauthName2") - - val requestDto = UpdateFemaleRequestDto( - animals = FemaleAnimals.FOX, - nickName = "NICKNICK", - mbti = MBTI.INFP, - introduce = "hihihi", - contact = "01012345678", - ) - - val test = mockMvc.patch("/users/my/female") { - contentType = MediaType.APPLICATION_JSON - content = objectMapper.writeValueAsString(requestDto) - } - - test.andExpect { - status { isOk() } - jsonPath("id") { exists() } - jsonPath("animals") { value("FOX") } - jsonPath("nickName") { value("NICKNICK") } - jsonPath("mbti") { value("INFP") } - jsonPath("introduce") { value("hihihi") } - jsonPath("contact") { value("01012345678") } - jsonPath("gender") { value("FEMALE") } - } - test.andDo { - print() - } - } - - @Test - fun updateMaleTestFailAnimalsAll() { - setPrincipal("oauthName2") - val requestDto = UpdateFemaleRequestDto( - animals = FemaleAnimals.ALL, - nickName = "NICKNICK", - mbti = MBTI.INFP, - introduce = "hihihi", - contact = "01012345678", - ) - val test = mockMvc.patch("/users/my/female") { - contentType = MediaType.APPLICATION_JSON - content = objectMapper.writeValueAsString(requestDto) - } - - test.andExpect { - status { isBadRequest() } - jsonPath("message") { value("ALL은 등록불가능 합니다.") } - } - test.andDo { - print() - } - } - - @Test - fun updateMaleTestFailNickNameDuplicate() { - setPrincipal("oauthName2") - val requestDto = UpdateFemaleRequestDto( - animals = FemaleAnimals.FOX, - nickName = "testNick1", - mbti = MBTI.INFP, - introduce = "hihihi", - contact = "01012345678", - ) - val test = mockMvc.patch("/users/my/female") { - contentType = MediaType.APPLICATION_JSON - content = objectMapper.writeValueAsString(requestDto) - } - - test.andExpect { - status { isBadRequest() } - jsonPath("message") { value("해당 닉네임은 이미 존재합니다.") } - } - test.andDo { - print() - } - } -} diff --git a/src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateMaleTest.kt b/src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateUserInfoTest.kt similarity index 59% rename from src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateMaleTest.kt rename to src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateUserInfoTest.kt index ce612b7..72df18b 100644 --- a/src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateMaleTest.kt +++ b/src/test/kotlin/com/yourssu/ssudateserver/controller/UpdateUserInfoTest.kt @@ -1,9 +1,8 @@ package com.yourssu.ssudateserver.controller import com.yourssu.ssudateserver.common.BaseTest -import com.yourssu.ssudateserver.dto.request.UpdateMaleRequestDto +import com.yourssu.ssudateserver.dto.request.UpdateRequestDto import com.yourssu.ssudateserver.enums.MBTI -import com.yourssu.ssudateserver.enums.MaleAnimals import com.yourssu.ssudateserver.fixture.PrincipalFixture.Companion.setPrincipal import org.junit.jupiter.api.Test import org.springframework.http.MediaType @@ -11,21 +10,20 @@ import org.springframework.test.context.ActiveProfiles import org.springframework.test.web.servlet.patch @ActiveProfiles("test") -class UpdateMaleTest : BaseTest() { +class UpdateUserInfoTest : BaseTest() { @Test fun updateMaleTest() { setPrincipal() - val requestDto = UpdateMaleRequestDto( - animals = MaleAnimals.WOLF, + val requestDto = UpdateRequestDto( nickName = "NICKNICK", mbti = MBTI.INFP, introduce = "hihihi", contact = "01012345678", ) - val test = mockMvc.patch("/users/my/male") { + val test = mockMvc.patch("/users/my") { contentType = MediaType.APPLICATION_JSON content = objectMapper.writeValueAsString(requestDto) } @@ -33,7 +31,7 @@ class UpdateMaleTest : BaseTest() { test.andExpect { status { isOk() } jsonPath("id") { exists() } - jsonPath("animals") { value("WOLF") } + jsonPath("animals") { value("PUSSUNG") } jsonPath("nickName") { value("NICKNICK") } jsonPath("mbti") { value("INFP") } jsonPath("introduce") { value("hihihi") } @@ -45,41 +43,16 @@ class UpdateMaleTest : BaseTest() { } } - @Test - fun updateMaleTestFailAnimalsAll() { - setPrincipal() - val requestDto = UpdateMaleRequestDto( - animals = MaleAnimals.ALL, - nickName = "NICKNICK", - mbti = MBTI.INFP, - introduce = "hihihi", - contact = "01012345678", - ) - val test = mockMvc.patch("/users/my/male") { - contentType = MediaType.APPLICATION_JSON - content = objectMapper.writeValueAsString(requestDto) - } - - test.andExpect { - status { isBadRequest() } - jsonPath("message") { value("ALL은 등록불가능 합니다.") } - } - test.andDo { - print() - } - } - @Test fun updateMaleTestFailNickNameDuplicate() { setPrincipal() - val requestDto = UpdateMaleRequestDto( - animals = MaleAnimals.BEAR, + val requestDto = UpdateRequestDto( nickName = "testNick2", mbti = MBTI.INFP, introduce = "hihihi", contact = "01012345678", ) - val test = mockMvc.patch("/users/my/male") { + val test = mockMvc.patch("/users/my") { contentType = MediaType.APPLICATION_JSON content = objectMapper.writeValueAsString(requestDto) }