use of org.orcid.pojo.DeprecateProfile in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testValidateDeprecateProfileWithInvalidDataBadCredentials.
@Test
public void testValidateDeprecateProfileWithInvalidDataBadCredentials() {
SecurityContextHolder.getContext().setAuthentication(getAuthentication(USER_ORCID));
// Using email
DeprecateProfile deprecateProfile = new DeprecateProfile();
deprecateProfile.setPrimaryOrcid(USER_ORCID);
deprecateProfile.setDeprecatingOrcidOrEmail("0000-0000-0000-0002_1@test.orcid.org");
deprecateProfile.setDeprecatingPassword("invalid password");
deprecateProfile = controller.validateDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("check_password_modal.incorrect_password", deprecateProfile.getErrors().get(0));
// Using orcid
deprecateProfile = new DeprecateProfile();
deprecateProfile.setDeprecatingOrcidOrEmail(DEPRECATED_USER_ORCID);
deprecateProfile.setDeprecatingPassword("invalid password");
deprecateProfile = controller.validateDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("check_password_modal.incorrect_password", deprecateProfile.getErrors().get(0));
}
use of org.orcid.pojo.DeprecateProfile in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testConfirmDeprecateProfileUnkownError.
@Test
public void testConfirmDeprecateProfileUnkownError() {
SecurityContextHolder.getContext().setAuthentication(getAuthentication(USER_ORCID));
DeprecateProfile deprecateProfile = new DeprecateProfile();
deprecateProfile.setPrimaryOrcid("0000-0000-0000-0003");
deprecateProfile.setDeprecatingOrcidOrEmail("0000-0000-0000-0004");
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.confirmDeprecateProfile(deprecateProfile);
assertNotNull(deprecateProfile);
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("deprecate_orcid.problem_deprecating", deprecateProfile.getErrors().get(0));
}
Aggregations