use of org.orcid.pojo.DeprecateProfile in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testGetDeprecateProfile.
@Test
public void testGetDeprecateProfile() {
DeprecateProfile deprecateProfile = controller.getDeprecateProfile();
assertNotNull(deprecateProfile);
assertNull(deprecateProfile.getPrimaryOrcid());
assertNull(deprecateProfile.getPrimaryAccountName());
assertNull(deprecateProfile.getPrimaryEmails());
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNull(deprecateProfile.getDeprecatingEmails());
assertNull(deprecateProfile.getDeprecatingOrcid());
assertNull(deprecateProfile.getDeprecatingPassword());
assertTrue(deprecateProfile.getErrors().isEmpty());
}
use of org.orcid.pojo.DeprecateProfile in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testConfirmDeprecateProfile.
@Test
public void testConfirmDeprecateProfile() {
SecurityContextHolder.getContext().setAuthentication(getAuthentication(USER_ORCID));
DeprecateProfile deprecateProfile = new DeprecateProfile();
deprecateProfile.setPrimaryOrcid(USER_ORCID);
deprecateProfile.setDeprecatingOrcidOrEmail(DEPRECATED_USER_ORCID);
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.confirmDeprecateProfile(deprecateProfile);
assertNotNull(deprecateProfile);
assertTrue(deprecateProfile.getErrors().isEmpty());
}
use of org.orcid.pojo.DeprecateProfile in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testConfirmDeprecateProfileWithInvalidDataAlreadyDeprecatedProfile.
@Test
public void testConfirmDeprecateProfileWithInvalidDataAlreadyDeprecatedProfile() {
SecurityContextHolder.getContext().setAuthentication(getAuthentication(USER_ORCID));
// Apply mocks
mocksForDeprecatedAccounts();
// Using orcid
DeprecateProfile deprecateProfile = new DeprecateProfile();
deprecateProfile.setPrimaryOrcid(USER_ORCID);
deprecateProfile.setDeprecatingOrcidOrEmail(DEPRECATED_USER_ORCID);
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.confirmDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("deprecate_orcid.already_deprecated", deprecateProfile.getErrors().get(0));
// Using email
deprecateProfile = new DeprecateProfile();
deprecateProfile.setDeprecatingOrcidOrEmail("0000-0000-0000-0002_1@test.orcid.org");
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.confirmDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("deprecate_orcid.already_deprecated", deprecateProfile.getErrors().get(0));
}
use of org.orcid.pojo.DeprecateProfile in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testConfirmDeprecateProfileWithInvalidDataDeactivatedProfile.
@Test
public void testConfirmDeprecateProfileWithInvalidDataDeactivatedProfile() {
SecurityContextHolder.getContext().setAuthentication(getAuthentication(USER_ORCID));
// Apply mocks
mocksForDeactivatedAccounts();
// Using orcid
DeprecateProfile deprecateProfile = new DeprecateProfile();
deprecateProfile.setPrimaryOrcid(USER_ORCID);
deprecateProfile.setDeprecatingOrcidOrEmail(DEPRECATED_USER_ORCID);
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.confirmDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("deprecate_orcid.already_deactivated", deprecateProfile.getErrors().get(0));
// Using email
deprecateProfile = new DeprecateProfile();
deprecateProfile.setDeprecatingOrcidOrEmail("0000-0000-0000-0002_1@test.orcid.org");
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.confirmDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("deprecate_orcid.already_deactivated", deprecateProfile.getErrors().get(0));
}
use of org.orcid.pojo.DeprecateProfile in project ORCID-Source by ORCID.
the class ManageProfileControllerTest method testValidateDeprecateProfileWithInvalidDataAlreadyDeprecatedProfile.
@Test
public void testValidateDeprecateProfileWithInvalidDataAlreadyDeprecatedProfile() {
SecurityContextHolder.getContext().setAuthentication(getAuthentication(USER_ORCID));
// Apply mocks
mocksForDeprecatedAccounts();
// Using orcid
DeprecateProfile deprecateProfile = new DeprecateProfile();
deprecateProfile.setPrimaryOrcid(USER_ORCID);
deprecateProfile.setDeprecatingOrcidOrEmail(DEPRECATED_USER_ORCID);
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.validateDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("deprecate_orcid.already_deprecated", deprecateProfile.getErrors().get(0));
// Using email
deprecateProfile = new DeprecateProfile();
deprecateProfile.setDeprecatingOrcidOrEmail("0000-0000-0000-0002_1@test.orcid.org");
deprecateProfile.setDeprecatingPassword("password");
deprecateProfile = controller.validateDeprecateProfile(deprecateProfile);
assertNull(deprecateProfile.getDeprecatingAccountName());
assertNotNull(deprecateProfile.getErrors());
assertEquals(1, deprecateProfile.getErrors().size());
assertEquals("deprecate_orcid.already_deprecated", deprecateProfile.getErrors().get(0));
}
Aggregations