-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
the end point takes an orcid or email as parameter (#7226)
* the end point takes an orcid or email as parameter * Fixed failing test
- Loading branch information
1 parent
3ea233b
commit 7168d25
Showing
5 changed files
with
72 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1429,13 +1429,15 @@ public void resetPasswordLink() throws Exception { | |
AdminController adminController = new AdminController(); | ||
EmailManager emailManager = Mockito.mock(EmailManager.class); | ||
LocaleManager localeManager = Mockito.mock(LocaleManager.class); | ||
ProfileEntityManager profileEntityManager = Mockito.mock(ProfileEntityManager.class); | ||
|
||
|
||
ReflectionTestUtils.setField(adminController, "verifyEmailUtils", verifyEmailUtils); | ||
ReflectionTestUtils.setField(adminController, "encryptionManager", encryptionManager); | ||
ReflectionTestUtils.setField(adminController, "emailManager", emailManager); | ||
ReflectionTestUtils.setField(adminController, "localeManager", localeManager); | ||
ReflectionTestUtils.setField(adminController, "orcidSecurityManager", orcidSecurityManager); | ||
ReflectionTestUtils.setField(adminController, "profileEntityManager", profileEntityManager); | ||
|
||
Mockito.when(orcidSecurityManager.isAdmin()).thenReturn(true); | ||
|
||
|
@@ -1445,18 +1447,20 @@ public void resetPasswordLink() throws Exception { | |
|
||
Mockito.when(localeManager.resolveMessage(Mockito.anyString(), Mockito.any())).thenReturn("That email address is not on our records"); | ||
Mockito.when(verifyEmailUtils.createResetLinkForAdmin(Mockito.anyString(), Mockito.any())).thenReturn(new Pair<String, Date>("xyz", new Date())); | ||
|
||
Mockito.when(localeManager.resolveMessage(Mockito.anyString(), Mockito.any())).thenReturn("That email address is not on our records"); | ||
Mockito.when(profileEntityManager.orcidExists(Mockito.anyString())).thenReturn(true); | ||
|
||
|
||
AdminResetPasswordLink adminResetPasswordLink = new AdminResetPasswordLink(); | ||
adminResetPasswordLink.setEmail("[email protected]"); | ||
adminResetPasswordLink.setOrcidOrEmail("[email protected]"); | ||
|
||
adminResetPasswordLink = adminController.resetPasswordLink(mockRequest, mockResponse, adminResetPasswordLink); | ||
|
||
assertEquals("That email address is not on our records", adminResetPasswordLink.getError()); | ||
|
||
adminResetPasswordLink = new AdminResetPasswordLink(); | ||
adminResetPasswordLink.setEmail("[email protected]"); | ||
Mockito.when(emailManager.findOrcidIdByEmail(Mockito.anyString())).thenReturn("0000-0002-0551-5914"); | ||
adminResetPasswordLink.setOrcidOrEmail("[email protected]"); | ||
XMLGregorianCalendar date = DateUtils.convertToXMLGregorianCalendarNoTimeZoneNoMillis(new Date()); | ||
Mockito.when(encryptionManager.decryptForExternalUse(Mockito.anyString())).thenReturn("[email protected]&issueDate="+ date.toXMLFormat()+ "&h=24"); | ||
adminResetPasswordLink = adminController.resetPasswordLink(mockRequest, mockResponse, adminResetPasswordLink); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters