use of edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo in project dataverse by IQSS.
the class GoogleOAuth2APTest method testParseUserResponseRealData.
@Test
public void testParseUserResponseRealData() {
AbstractOAuth2AuthenticationProvider.ParsedUserResponse expResult = new AbstractOAuth2AuthenticationProvider.ParsedUserResponse(new AuthenticatedUserDisplayInfo("Philip", "Durbin", "philipdurbin@gmail.com", "", ""), null, null);
AbstractOAuth2AuthenticationProvider.ParsedUserResponse result = parseUserResponse(GOOGLE_RESPONSE);
assertEquals(expResult.displayInfo, result.displayInfo);
assertEquals("107770072576338242009", result.userIdInProvider);
assertEquals("philipdurbin", result.username);
assertEquals("Philip", result.displayInfo.getFirstName());
assertEquals("Durbin", result.displayInfo.getLastName());
assertEquals("philipdurbin@gmail.com", result.displayInfo.getEmailAddress());
assertEquals("", result.displayInfo.getPosition());
assertEquals("", result.displayInfo.getAffiliation());
}
use of edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo in project dataverse by IQSS.
the class BuiltinAuthenticationProviderTest method testUpdateUserInfo.
/**
* Test of updateUserInfo method, of class BuiltinAuthenticationProvider.
*/
@Test
public void testUpdateUserInfo() {
BuiltinUser user = bean.save(makeBuiltInUser());
AuthenticatedUserDisplayInfo newInfo = new AuthenticatedUserDisplayInfo("nf", "nl", "ema@il.com", "newAffi", "newPos");
sut.updateUserInfo(user.getUserName(), newInfo);
assertEquals(newInfo, user.getDisplayInfo());
}
use of edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo in project dataverse by IQSS.
the class OrcidOAuth2APTest method testParseActivitiesResponseNoOrgName.
@Test
public void testParseActivitiesResponseNoOrgName() {
OrcidOAuth2AP sut = new OrcidOAuth2AP("clientId", "clientSecret", "userEndpoint");
assertNotNull(ACTIVITIES);
String responseWithNoOrg = ACTIVITIES.replaceAll("\n", "").replaceAll("<employment:organization>.*</employment:organization>", "");
final AuthenticatedUserDisplayInfo actual = sut.parseActivitiesResponse(responseWithNoOrg);
assertEquals(null, actual.getAffiliation());
assertEquals("role, department", actual.getPosition());
}
use of edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo in project dataverse by IQSS.
the class OrcidOAuth2APTest method testParseActivitiesResponse.
@Test
public void testParseActivitiesResponse() {
OrcidOAuth2AP sut = new OrcidOAuth2AP("clientId", "clientSecret", "userEndpoint");
assertNotNull(ACTIVITIES);
final AuthenticatedUserDisplayInfo actual = sut.parseActivitiesResponse(ACTIVITIES);
assertEquals("My Organization Name", actual.getAffiliation());
assertEquals("role, department", actual.getPosition());
}
use of edu.harvard.iq.dataverse.authorization.AuthenticatedUserDisplayInfo in project dataverse by IQSS.
the class AuthenticatedUserTest method testGetDisplayInfo.
@Test
public void testGetDisplayInfo() {
System.out.println("getDisplayInfo");
AuthenticatedUserDisplayInfo expResult = new AuthenticatedUserDisplayInfo("Homer", "Simpson", "Homer.Simpson@someU.edu", "UnitTester", "In-Memory user");
AuthenticatedUserDisplayInfo result = testUser.getDisplayInfo();
assertEquals(expResult, result);
}
Aggregations