use of org.eclipse.linuxtools.internal.mylyn.osio.rest.core.OSIORestGetAuthUser in project linuxtools by eclipse.
the class TestOSIORestGetAuthUser method testGetAuthUser.
@Test
public void testGetAuthUser() throws Exception {
TestData testData = new TestData();
TestUtils.initSpaces(requestProvider, testData);
OSIORestClient client = connector.getClient(repository, requestProvider);
OSIORestConfiguration config = client.getConfiguration(repository, new NullOperationMonitor());
config.setSpaces(testData.spaceMap);
connector.setConfiguration(config);
RepositoryLocation location = client.getClient().getLocation();
location.setProperty(IOSIORestConstants.REPOSITORY_AUTH_ID, "user");
location.setProperty(IOSIORestConstants.REPOSITORY_AUTH_TOKEN, "xxxxxxTokenxxxxxx");
OSIORestGetAuthUser data = new OSIORestGetAuthUser(client.getClient());
String bundleLocation = Activator.getContext().getBundle().getLocation();
int index = bundleLocation.indexOf('/');
String fileName = bundleLocation.substring(index) + "/testjson/authuser.data";
FileReader in = new FileReader(fileName);
Identity user = data.testParseFromJson(in);
assertEquals("User.org", user.getCompany());
assertEquals("user@user.org", user.getEmail());
assertEquals("User 1", user.getFullName());
assertEquals("IDENTITY-0001", user.getIdentityID());
assertEquals("https://www.gravatar.com/avatar/user.jpg", user.getImageURL());
assertEquals("USER-0001", user.getUserID());
assertEquals("user", user.getUsername());
assertEquals("IDENTITY-0001", user.getId());
}
Aggregations