| | |
| | | import com.tourguide.modules.user.dto.GuideRegistrationTokenResponse; |
| | | import com.tourguide.modules.user.dto.SmsCodeResponse; |
| | | import com.tourguide.modules.user.entity.GuideApplication; |
| | | import com.tourguide.modules.user.entity.GuideUser; |
| | | import com.tourguide.modules.user.mapper.GuideApplicationMapper; |
| | | import com.tourguide.modules.user.mapper.GuideTeamMapper; |
| | | import org.junit.jupiter.api.BeforeEach; |
| | |
| | | private ValueOperations<String, String> valueOperations; |
| | | private GuideApplicationMapper applicationMapper; |
| | | private GuideVerificationCodeService verificationCodeService; |
| | | private GuideUserService guideUserService; |
| | | private GuideRegistrationService service; |
| | | |
| | | @SuppressWarnings("unchecked") |
| | |
| | | .thenReturn("13800138000"); |
| | | when(applicationMapper.selectCount(any())).thenReturn(0L); |
| | | |
| | | GuideUserService guideUserService = mock(GuideUserService.class); |
| | | guideUserService = mock(GuideUserService.class); |
| | | when(guideUserService.findByPhone("13800138000")).thenReturn(null); |
| | | OperationCityMapper cityMapper = mock(OperationCityMapper.class); |
| | | OperationCity city = new OperationCity(); |
| | |
| | | } |
| | | |
| | | @Test |
| | | void shouldAllowCancelledGuideToRegisterAgain() { |
| | | GuideUser guide = new GuideUser(); |
| | | guide.setStatus(GuideUserService.STATUS_CANCELLED); |
| | | when(guideUserService.findByPhone("13800138000")).thenReturn(guide); |
| | | |
| | | GuideRegistrationTokenResponse response = service.verifyPhone("13800138000", "794535"); |
| | | |
| | | assertThat(response.getRegistrationToken()).isNotBlank(); |
| | | verify(verificationCodeService).verifyAndConsume("13800138000", "794535", "registration"); |
| | | } |
| | | |
| | | @Test |
| | | void shouldCreatePendingApplicationAndConsumeToken() { |
| | | GuideRegistrationSubmitRequest request = new GuideRegistrationSubmitRequest(); |
| | | request.setRealName("张导游"); |