Search in sources :

Example 1 with TwitterProvider

use of org.olat.login.oauth.spi.TwitterProvider in project OpenOLAT by OpenOLAT.

the class OAuthDispatcherTest method parseUserInfos_twitter.

@Test
public void parseUserInfos_twitter() throws IOException {
    URL jsonUrl = OAuthDispatcherTest.class.getResource("verify_credentials.json");
    String body = IOUtils.toString(jsonUrl, "UTF-8");
    OAuthUser infos = new TwitterProvider().parseInfos(body);
    Assert.assertNotNull(infos);
    Assert.assertEquals("38895958", infos.getId());
    Assert.assertEquals("Sean", infos.getFirstName());
    Assert.assertEquals("Cook", infos.getLastName());
    Assert.assertEquals("en", infos.getLang());
}
Also used : TwitterProvider(org.olat.login.oauth.spi.TwitterProvider) OAuthUser(org.olat.login.oauth.model.OAuthUser) URL(java.net.URL) Test(org.junit.Test)

Example 2 with TwitterProvider

use of org.olat.login.oauth.spi.TwitterProvider in project openolat by klemens.

the class OAuthDispatcherTest method parseUserInfos_twitter.

@Test
public void parseUserInfos_twitter() throws IOException {
    URL jsonUrl = OAuthDispatcherTest.class.getResource("verify_credentials.json");
    String body = IOUtils.toString(jsonUrl, "UTF-8");
    OAuthUser infos = new TwitterProvider().parseInfos(body);
    Assert.assertNotNull(infos);
    Assert.assertEquals("38895958", infos.getId());
    Assert.assertEquals("Sean", infos.getFirstName());
    Assert.assertEquals("Cook", infos.getLastName());
    Assert.assertEquals("en", infos.getLang());
}
Also used : TwitterProvider(org.olat.login.oauth.spi.TwitterProvider) OAuthUser(org.olat.login.oauth.model.OAuthUser) URL(java.net.URL) Test(org.junit.Test)

Aggregations

URL (java.net.URL)2 Test (org.junit.Test)2 OAuthUser (org.olat.login.oauth.model.OAuthUser)2 TwitterProvider (org.olat.login.oauth.spi.TwitterProvider)2