@Test(expectedExceptions = AuthorizationException.class) public void testListTenantsFailNotAuthorized() { TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(), HttpResponse.builder().statusCode(401).build()).getTenantApi().get(); api.get("013ba41150a14830bec85ffe93353bcc"); }
@Test(enabled = false) public void testListTenantsFailNotFound() { TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(404).build()) .getTenantApi().get(); assertTrue(api.list().isEmpty()); }
public void testGetTenantByNameFailNotFound() { TenantApi api = requestsSendResponses(keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(), HttpResponse.builder().statusCode(404).build()).getTenantApi().get(); assertNull(api.getByName("admin")); }
public void testListTenantsPage() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Set<? extends Tenant> tenants = api.list(new PaginationOptions()).toSet(); assertNotNull(tenants); assertFalse(tenants.isEmpty()); assertEquals(tenants, expectedTenants); }
public void testListTenantsPage() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Set<? extends Tenant> tenants = api.list(new PaginationOptions()).toSet(); assertNotNull(tenants); assertFalse(tenants.isEmpty()); assertEquals(tenants, expectedTenants); }
public void testListTenants() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build()) .getTenantApi().get(); assertEquals(api.list().concat().toSet(), expectedTenants); }
@Test(enabled = false) public void testListTenantsATT() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list_att.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Set<Tenant> expected = ImmutableSet.of(Tenant.builder().name("this-is-a-test").id("14").description("None").build()); assertEquals(api.list().concat().toSet(), expected); }
public void testListTenants() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)).build()) .getTenantApi().get(); assertEquals(api.list().concat().toSet(), expectedTenants); }
@Test(enabled = false) public void testListTenantsATT() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_list_att.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Set<Tenant> expected = ImmutableSet.of(Tenant.builder().name("this-is-a-test").id("14").description("None").build()); assertEquals(api.list().concat().toSet(), expected); }
public void testGetTenant() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Tenant tenant = api.get("013ba41150a14830bec85ffe93353bcc"); assertNotNull(tenant); assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build()); }
public void testGetTenantByName() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Tenant tenant = api.getByName("admin"); assertNotNull(tenant); assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").build()); }
public void testGetTenant() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants/013ba41150a14830bec85ffe93353bcc").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Tenant tenant = api.get("013ba41150a14830bec85ffe93353bcc"); assertNotNull(tenant); assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").enabled(true). build()); }
public void testGetTenantByName() { TenantApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants?name=admin").build(), HttpResponse.builder().statusCode(200).payload( payloadFromResourceWithContentType("/tenant_details.json", APPLICATION_JSON)).build()) .getTenantApi().get(); Tenant tenant = api.getByName("admin"); assertNotNull(tenant); assertEquals(tenant, Tenant.builder().id("013ba41150a14830bec85ffe93353bcc").name("admin").enabled(true). build()); }