-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from ClothingStoreService/refactor/order-test
Refactor/order test
- Loading branch information
Showing
8 changed files
with
409 additions
and
216 deletions.
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
17 changes: 0 additions & 17 deletions
17
src/main/kotlin/org/store/clothstar/kakaoLogin/dto/KakaoRenewTokenResponseDto.kt
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
src/main/kotlin/org/store/clothstar/kakaoLogin/dto/KakaoTokenInfoResponseDto.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
src/main/kotlin/org/store/clothstar/kakaoLogin/dto/TokenUserInfoResponseDto.kt
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
|
@@ -3,18 +3,23 @@ package org.store.clothstar.member.authentication.controller | |
import com.fasterxml.jackson.databind.ObjectMapper | ||
import okhttp3.mockwebserver.MockResponse | ||
import okhttp3.mockwebserver.MockWebServer | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
import org.junit.jupiter.api.DisplayName | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.assertThrows | ||
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 org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post | ||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.status | ||
import org.springframework.test.web.servlet.result.MockMvcResultMatchers.* | ||
import org.springframework.transaction.annotation.Transactional | ||
import org.store.clothstar.common.config.redis.RedisUtil | ||
import org.store.clothstar.common.error.ErrorCode | ||
import org.store.clothstar.common.error.exception.InvalidSignupMemberRequest | ||
import org.store.clothstar.common.error.exception.order.OrderNotFoundException | ||
import org.store.clothstar.kakaoLogin.service.KakaoLoginService | ||
import org.store.clothstar.member.authentication.domain.SignUpType | ||
import org.store.clothstar.member.dto.request.KakaoMemberRequest | ||
|
@@ -145,4 +150,58 @@ class AuthenticationControllerTest( | |
|
||
mockWebServer.shutdown() | ||
} | ||
|
||
@DisplayName("멤버 카카오 회원가입에서 요청DTO가 NULL일 경우 에러처리 테스트") | ||
@Test | ||
fun normalSignUpExceptionTest() { | ||
//kakaoMemberRequest 요청 DTO 생성 | ||
val kakaoMemberRequest = KakaoMemberRequest( | ||
name = "Test User", | ||
telNo = "010-1234-5678", | ||
email = null, | ||
code = "test_code" | ||
) | ||
|
||
// kakaoMemberRequest를 null로 맞춤 | ||
val signUpRequest = SignUpRequest(null, kakaoMemberRequest) | ||
val requestBody = objectMapper.writeValueAsString(signUpRequest) | ||
|
||
//when & then | ||
mockMvc.perform( | ||
post(MEMBER_URL) | ||
.param("signUpType", SignUpType.NORMAL.toString()) | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.content(requestBody) | ||
) | ||
.andExpect(status().isBadRequest) | ||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) | ||
.andExpect(jsonPath("$.errorCode").value(400)) | ||
.andExpect(jsonPath("$.message").value("회원가입 시 회원 정보가 필요합니다.")) | ||
} | ||
|
||
@DisplayName("멤버 카카오 회원가입에서 요청DTO가 NULL일 경우 에러처리 테스트") | ||
@Test | ||
fun kakaoSignUpExceptionTest() { | ||
// createMemberRequest 생성을 위한 이메일과 인증번호로 redis 데이터 생성 | ||
val email = "[email protected]" | ||
val certifyNum = redisUtil.createdCertifyNum() | ||
redisUtil.createRedisData(email, certifyNum) | ||
|
||
// kakaoMemberRequest를 null로 맞춤 | ||
val createMemberRequest = CreateObject.getCreateMemberRequest(email, certifyNum) | ||
val signUpRequest = SignUpRequest(createMemberRequest, null) | ||
val requestBody = objectMapper.writeValueAsString(signUpRequest) | ||
|
||
//when & then | ||
mockMvc.perform( | ||
post(MEMBER_URL) | ||
.param("signUpType", SignUpType.KAKAO.toString()) | ||
.contentType(MediaType.APPLICATION_JSON) | ||
.content(requestBody) | ||
) | ||
.andExpect(status().isBadRequest) | ||
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) | ||
.andExpect(jsonPath("$.errorCode").value(400)) | ||
.andExpect(jsonPath("$.message").value("회원가입 시 회원 정보가 필요합니다.")) | ||
} | ||
} |
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
Oops, something went wrong.