|
5 | 5 | import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.*; |
6 | 6 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; |
7 | 7 |
|
8 | | -import java.time.LocalDate; |
9 | 8 | import java.time.LocalDateTime; |
10 | 9 |
|
11 | 10 | import org.junit.jupiter.api.BeforeEach; |
|
31 | 30 | import com.back.domain.user.entity.User; |
32 | 31 | import com.back.domain.user.entity.UserRole; |
33 | 32 | import com.back.domain.user.repository.UserRepository; |
34 | | -import com.back.global.error.code.CommonErrorCode; |
35 | 33 | import com.back.global.error.code.EventErrorCode; |
36 | 34 | import com.back.global.error.code.PreRegisterErrorCode; |
37 | 35 | import com.back.support.data.TestUser; |
@@ -135,65 +133,66 @@ void register_Success() throws Exception { |
135 | 133 | assertThat(savedPreRegister.getPreRegisterAgreePrivacy()).isTrue(); |
136 | 134 | } |
137 | 135 |
|
138 | | - @Test |
139 | | - @DisplayName("생년월일이 일치하지 않으면 400 에러 (본인 인증 실패)") |
140 | | - void register_Fail_InvalidBirthDate() throws Exception { |
141 | | - // given: 잘못된 생년월일 |
142 | | - testAuthHelper.authenticate(testUser.user()); |
143 | | - setSmsVerified(DEFAULT_PHONE_NUMBER); |
144 | | - |
145 | | - PreRegisterCreateRequest request = PreRegisterRequestFactory.fakePreRegisterRequest( |
146 | | - LocalDate.of(2000, 1, 1) // 실제 생년월일과 다름 |
147 | | - ); |
148 | | - |
149 | | - // when & then |
150 | | - mockMvc.perform(post("/api/v1/events/{eventId}/pre-registers", testEvent.getId()) |
151 | | - .contentType(MediaType.APPLICATION_JSON) |
152 | | - .content(objectMapper.writeValueAsString(request))) |
153 | | - .andDo(print()) |
154 | | - .andExpect(status().isBadRequest()) |
155 | | - .andExpect(jsonPath("$.message").value(PreRegisterErrorCode.INVALID_USER_INFO.getMessage())); |
156 | | - } |
157 | | - |
158 | | - @Test |
159 | | - @DisplayName("이용약관 미동의 시 400 에러") |
160 | | - void register_Fail_TermsNotAgreed() throws Exception { |
161 | | - // given: 이용약관 미동의 |
162 | | - testAuthHelper.authenticate(testUser.user()); |
163 | | - setSmsVerified(DEFAULT_PHONE_NUMBER); |
164 | | - |
165 | | - PreRegisterCreateRequest request = PreRegisterRequestFactory.fakePreRegisterRequestWithoutTerms( |
166 | | - testUser.user().getBirthDate() |
167 | | - ); |
168 | | - |
169 | | - // when & then |
170 | | - mockMvc.perform(post("/api/v1/events/{eventId}/pre-registers", testEvent.getId()) |
171 | | - .contentType(MediaType.APPLICATION_JSON) |
172 | | - .content(objectMapper.writeValueAsString(request))) |
173 | | - .andDo(print()) |
174 | | - .andExpect(status().isBadRequest()) |
175 | | - .andExpect(jsonPath("$.message").value(PreRegisterErrorCode.TERMS_NOT_AGREED.getMessage())); |
176 | | - } |
177 | | - |
178 | | - @Test |
179 | | - @DisplayName("개인정보 수집 미동의 시 400 에러") |
180 | | - void register_Fail_PrivacyNotAgreed() throws Exception { |
181 | | - // given: 개인정보 수집 미동의 |
182 | | - testAuthHelper.authenticate(testUser.user()); |
183 | | - setSmsVerified(DEFAULT_PHONE_NUMBER); |
184 | | - |
185 | | - PreRegisterCreateRequest request = PreRegisterRequestFactory.fakePreRegisterRequestWithoutPrivacy( |
186 | | - testUser.user().getBirthDate() |
187 | | - ); |
188 | | - |
189 | | - // when & then |
190 | | - mockMvc.perform(post("/api/v1/events/{eventId}/pre-registers", testEvent.getId()) |
191 | | - .contentType(MediaType.APPLICATION_JSON) |
192 | | - .content(objectMapper.writeValueAsString(request))) |
193 | | - .andDo(print()) |
194 | | - .andExpect(status().isBadRequest()) |
195 | | - .andExpect(jsonPath("$.message").value(PreRegisterErrorCode.PRIVACY_NOT_AGREED.getMessage())); |
196 | | - } |
| 136 | + // 인증 없는 사전 등록을 위해 임시 주석 처리 |
| 137 | + // @Test |
| 138 | + // @DisplayName("생년월일이 일치하지 않으면 400 에러 (본인 인증 실패)") |
| 139 | + // void register_Fail_InvalidBirthDate() throws Exception { |
| 140 | + // // given: 잘못된 생년월일 |
| 141 | + // testAuthHelper.authenticate(testUser.user()); |
| 142 | + // setSmsVerified(DEFAULT_PHONE_NUMBER); |
| 143 | + // |
| 144 | + // PreRegisterCreateRequest request = PreRegisterRequestFactory.fakePreRegisterRequest( |
| 145 | + // LocalDate.of(2000, 1, 1) // 실제 생년월일과 다름 |
| 146 | + // ); |
| 147 | + // |
| 148 | + // // when & then |
| 149 | + // mockMvc.perform(post("/api/v1/events/{eventId}/pre-registers", testEvent.getId()) |
| 150 | + // .contentType(MediaType.APPLICATION_JSON) |
| 151 | + // .content(objectMapper.writeValueAsString(request))) |
| 152 | + // .andDo(print()) |
| 153 | + // .andExpect(status().isBadRequest()) |
| 154 | + // .andExpect(jsonPath("$.message").value(PreRegisterErrorCode.INVALID_USER_INFO.getMessage())); |
| 155 | + // } |
| 156 | + // |
| 157 | + // @Test |
| 158 | + // @DisplayName("이용약관 미동의 시 400 에러") |
| 159 | + // void register_Fail_TermsNotAgreed() throws Exception { |
| 160 | + // // given: 이용약관 미동의 |
| 161 | + // testAuthHelper.authenticate(testUser.user()); |
| 162 | + // setSmsVerified(DEFAULT_PHONE_NUMBER); |
| 163 | + // |
| 164 | + // PreRegisterCreateRequest request = PreRegisterRequestFactory.fakePreRegisterRequestWithoutTerms( |
| 165 | + // testUser.user().getBirthDate() |
| 166 | + // ); |
| 167 | + // |
| 168 | + // // when & then |
| 169 | + // mockMvc.perform(post("/api/v1/events/{eventId}/pre-registers", testEvent.getId()) |
| 170 | + // .contentType(MediaType.APPLICATION_JSON) |
| 171 | + // .content(objectMapper.writeValueAsString(request))) |
| 172 | + // .andDo(print()) |
| 173 | + // .andExpect(status().isBadRequest()) |
| 174 | + // .andExpect(jsonPath("$.message").value(PreRegisterErrorCode.TERMS_NOT_AGREED.getMessage())); |
| 175 | + // } |
| 176 | + // |
| 177 | + // @Test |
| 178 | + // @DisplayName("개인정보 수집 미동의 시 400 에러") |
| 179 | + // void register_Fail_PrivacyNotAgreed() throws Exception { |
| 180 | + // // given: 개인정보 수집 미동의 |
| 181 | + // testAuthHelper.authenticate(testUser.user()); |
| 182 | + // setSmsVerified(DEFAULT_PHONE_NUMBER); |
| 183 | + // |
| 184 | + // PreRegisterCreateRequest request = PreRegisterRequestFactory.fakePreRegisterRequestWithoutPrivacy( |
| 185 | + // testUser.user().getBirthDate() |
| 186 | + // ); |
| 187 | + // |
| 188 | + // // when & then |
| 189 | + // mockMvc.perform(post("/api/v1/events/{eventId}/pre-registers", testEvent.getId()) |
| 190 | + // .contentType(MediaType.APPLICATION_JSON) |
| 191 | + // .content(objectMapper.writeValueAsString(request))) |
| 192 | + // .andDo(print()) |
| 193 | + // .andExpect(status().isBadRequest()) |
| 194 | + // .andExpect(jsonPath("$.message").value(PreRegisterErrorCode.PRIVACY_NOT_AGREED.getMessage())); |
| 195 | + // } |
197 | 196 |
|
198 | 197 | @Test |
199 | 198 | @DisplayName("중복 등록 시 400 에러") |
|
0 commit comments