public void testCallIdentityService() { // Get auth token and identity url (through refresh) LoginOptions loginOptions = new LoginOptions(TestCredentials.LOGIN_URL, TestCredentials.CLIENT_ID, null, null); AuthResponse refreshResponse = OAuth2.RefreshAuthToken(loginOptions, TestCredentials.REFRESH_TOKEN).Result; // Call the identity service IdentityResponse identityResponse = OAuth2.CallIdentityService(refreshResponse.IdentityUrl, refreshResponse.AccessToken).Result; // Check username Assert.AreEqual("*****@*****.**", identityResponse.UserName); }
public void TestRefreshAuthToken() { // Try describe without being authenticated, expect 401 Assert.AreEqual(HttpStatusCode.Unauthorized, DoDescribe(null)); // Get auth token (through refresh) LoginOptions loginOptions = new LoginOptions(TestCredentials.LOGIN_URL, TestCredentials.CLIENT_ID, null, null); AuthResponse refreshResponse = OAuth2.RefreshAuthToken(loginOptions, TestCredentials.REFRESH_TOKEN).Result; // Try describe again, expect 200 Assert.AreEqual(HttpStatusCode.OK, DoDescribe(refreshResponse.AccessToken)); }