use of org.openhab.binding.netatmo.internal.authentication.RefreshTokenRequestStub in project openhab1-addons by openhab.
the class RefreshTokenTest method testSuccess.
@Test
public void testSuccess() throws Exception {
final RefreshTokenRequestStub request = createRequest("/token.json");
final RefreshTokenResponse response = request.execute();
assertFalse(response.isError());
assertNull(response.getError());
assertEquals("grant_type=refresh_token&refresh_token=" + REFRESH_TOKEN + "&client_id=" + CLIENT_ID + "&client_secret=" + CLIENT_SECRET + "&scope=read_station read_camera", request.getContent());
assertEquals("000000000000000000000000|11111111111111111111111111111111", response.getAccessToken());
}
use of org.openhab.binding.netatmo.internal.authentication.RefreshTokenRequestStub in project openhab1-addons by openhab.
the class RefreshTokenTest method testError.
@Test
public void testError() throws Exception {
final RefreshTokenRequestStub request = createRequest("/error-2.json");
final RefreshTokenResponse response = request.execute();
assertTrue(response.isError());
final NetatmoError error = response.getError();
assertNotNull(error);
assertEquals(2, error.getCode());
assertEquals("Invalid access token", error.getMessage());
}
Aggregations