public void testListTenants() { ServiceApi api = requestsSendResponses( keystoneAuthWithUsernameAndPasswordAndTenantName, responseWithKeystoneAccess, authenticatedGET().endpoint(endpoint + "/v2.0/tenants").build(), HttpResponse.builder() .statusCode(200) .payload( payloadFromResourceWithContentType("/tenant_list.json", APPLICATION_JSON)) .build()) .getServiceApi(); Set<? extends Tenant> tenants = api.listTenants(); assertNotNull(tenants); assertFalse(tenants.isEmpty()); Set<Tenant> expected = ImmutableSet.of( Tenant.builder() .name("demo") .id("05d1dc7af71646deba64cfc17b81bec0") .enabled(true) .build(), Tenant.builder() .name("admin") .id("7aa2e17ec29f44d193c48feaba0852cc") .enabled(true) .build()); assertEquals(tenants, expected); }
// @Test // URL Pattern: [usage][getHello]=2 // EXPECTED: Success; hits +2 public void testAuthrepUsageWithNestedMethodAndUserKey() throws ServerError { ParameterMap usage = new ParameterMap(); usage.add("getHello", "2"); params.add("usage", usage); AuthorizeResponse auresp = serviceApi.authrep(params); reportResult(auresp); }
// @Test // URL Pattern: [usage][hits]=1 // Expected: OK results in Hits incrementing by 1 public void testAuthrepEmptyUsageAndUserKey() throws ServerError { ParameterMap usage = new ParameterMap(); params.add("usage", usage); AuthorizeResponse auresp = serviceApi.authrep(params); reportResult(auresp); }
// @Test // URL Pattern: [usage][hits]=1 // Expected: OK results in Hits incrementing by 1 public void test_successful_report() throws ServerError { ParameterMap usage = new ParameterMap(); usage.add("hits", "1"); params.add("usage", usage); ReportResponse response = serviceApi.report(TestKeys.user_key_service_id, params); assertTrue(response.success()); }
// @Test // URL Pattern: [usage][hits]=1 // Expected: OK results in Hits incrementing by 1 public void testAuthrepNullUsageAndUserKey() throws ServerError { AuthorizeResponse auresp = serviceApi.authrep(params); reportResult(auresp); }
// @Test // URL http://requestb.in/1k27m9c1 // In order to visually examine the request headers in a POST // public void testPostToRequestBin() throws ServerError { AuthorizeResponse auresp = serviceApi.authrep(params); reportResult(auresp); }
// @Test // Expected: success public void testAuthorizeWithEternityPeriod() throws ServerError { AuthorizeResponse response = serviceApi.authorize(params); assertTrue(response.success()); }