use of org.orcid.pojo.EmailRequest in project ORCID-Source by ORCID.
the class ClaimControllerTest method testResendClaimEmail.
@Test
public void testResendClaimEmail() {
BindingResult bindingResult = mock(BindingResult.class);
when(bindingResult.hasErrors()).thenReturn(false);
when(emailManager.emailExists("billie@holiday.com")).thenReturn(true);
when(emailManager.findOrcidIdByEmail("billie@holiday.com")).thenReturn("0000-0000-0000-0000");
when(profileEntityCacheManager.retrieve(Mockito.anyString())).thenReturn(getProfileEntityToTestClaimResend(false));
EmailRequest emailRequest = new EmailRequest();
emailRequest.setEmail("billie@holiday.com");
emailRequest = claimController.resendClaimEmail(emailRequest);
assertNotNull(emailRequest);
assertNotNull(emailRequest.getSuccessMessage());
}
use of org.orcid.pojo.EmailRequest in project ORCID-Source by ORCID.
the class PasswordResetControllerTest method testPasswordResetUserNotFound.
@Test
public void testPasswordResetUserNotFound() {
when(orcidProfileManager.retrieveOrcidProfileByEmail(Mockito.anyString(), Mockito.any(LoadOptions.class))).thenReturn(null);
EmailRequest resetRequest = new EmailRequest();
resetRequest = passwordResetController.issuePasswordResetRequest(new MockHttpServletRequest(), resetRequest).getBody();
assertNotNull(resetRequest.getErrors());
assertFalse(resetRequest.getErrors().isEmpty());
}
use of org.orcid.pojo.EmailRequest in project ORCID-Source by ORCID.
the class ClaimControllerTest method testResendEmailFailIfTheProfileIsAlreadyClaimed.
@Test
public void testResendEmailFailIfTheProfileIsAlreadyClaimed() {
BindingResult bindingResult = mock(BindingResult.class);
when(bindingResult.hasErrors()).thenReturn(false);
when(emailManager.emailExists("billie@holiday.com")).thenReturn(true);
when(emailManager.findOrcidIdByEmail("billie@holiday.com")).thenReturn("0000-0000-0000-0000");
when(profileEntityCacheManager.retrieve(Mockito.anyString())).thenReturn(getProfileEntityToTestClaimResend(true));
EmailRequest emailRequest = new EmailRequest();
emailRequest.setEmail("billie@holiday.com");
emailRequest = claimController.resendClaimEmail(emailRequest);
assertNotNull(emailRequest);
assertNull(emailRequest.getSuccessMessage());
assertNotNull(emailRequest.getErrors());
assertFalse(emailRequest.getErrors().isEmpty());
}
use of org.orcid.pojo.EmailRequest in project ORCID-Source by ORCID.
the class PasswordResetControllerTest method testPasswordResetUserDeactivated.
@Test
public void testPasswordResetUserDeactivated() throws DatatypeConfigurationException {
GregorianCalendar c = new GregorianCalendar();
c.setTime(new Date());
XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
OrcidHistory orcidHistory = new OrcidHistory();
orcidHistory.setDeactivationDate(new DeactivationDate(date));
OrcidProfile deactivatedProfile = new OrcidProfile();
deactivatedProfile.setOrcidHistory(orcidHistory);
when(orcidProfileManager.retrieveOrcidProfileByEmail(Mockito.anyString(), Mockito.any(LoadOptions.class))).thenReturn(deactivatedProfile);
EmailRequest resetRequest = new EmailRequest();
resetRequest = passwordResetController.issuePasswordResetRequest(new MockHttpServletRequest(), resetRequest).getBody();
assertNotNull(resetRequest.getErrors());
assertFalse(resetRequest.getErrors().isEmpty());
}
Aggregations