public void testInvalidToken() { TokenApi tokenApi = api.getTokenApi().get(); assertFalse(tokenApi.isValid("thisisnotarealtoken!")); assertNull(tokenApi.get("thisisnotarealtoken!")); }
public void testToken() { TokenApi tokenApi = api.getTokenApi().get(); assertTrue(tokenApi.isValid(token)); Token result = tokenApi.get(token); assertNotNull(result); assertEquals(result.getId(), token); assertNotNull(result.getTenant()); User user = tokenApi.getUserOfToken(token); assertNotNull(user); assertNotNull(user.getId()); assertNotNull(user.getName()); }
public void testToken() { TokenApi tokenApi = api.getTokenApi().get(); assertTrue(tokenApi.isValid(token)); Token result = tokenApi.get(token); assertNotNull(result); assertEquals(result.getId(), token); assertNotNull(result.getTenant()); User user = tokenApi.getUserOfToken(token); assertNotNull(user); assertNotNull(user.getId()); assertNotNull(user.getName()); }
public void testInvalidToken() { TokenApi tokenApi = api.getTokenApi().get(); assertFalse(tokenApi.isValid("thisisnotarealtoken!")); assertNull(tokenApi.get("thisisnotarealtoken!")); }
@Test(expectedExceptions = HttpResponseException.class) public void testGetTokenFail500() { TokenApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(), HttpResponse.builder().statusCode(500).build()).getTokenApi().get(); api.get("sometokenorother"); }
public void testGetTokenFailNotFound() { TokenApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(), HttpResponse.builder().statusCode(404).build()) .getTokenApi().get(); assertNull(api.get("sometokenorother")); }
public void testGetToken() { TokenApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(), HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build()) .getTokenApi().get(); Token token = api.get("sometokenorother"); assertNotNull(token); assertEquals(token, Token.builder().id("167eccdc790946969ced473732e8109b").expires(dateService.iso8601SecondsDateParse("2012-04-28T12:42:50Z")) .tenant(Tenant.builder().id("4cea93f5464b4f1c921fb3e0461d72b5").name("demo").build()).build()); }
public void testGetToken() { TokenApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tokens/sometokenorother").build(), HttpResponse.builder().statusCode(200).payload(payloadFromResourceWithContentType("/token_details.json", APPLICATION_JSON)).build()) .getTokenApi().get(); Token token = api.get("sometokenorother"); assertNotNull(token); assertEquals(token, Token.builder().id("167eccdc790946969ced473732e8109b").expires(dateService.iso8601SecondsDateParse("2012-04-28T12:42:50Z")) .tenant(Tenant.builder().id("4cea93f5464b4f1c921fb3e0461d72b5").name("demo").enabled(true).build()).build()); }