use of com.auth0.net.Request in project auth0-java by auth0.
the class ClientGrantsEntityTest method shouldListClientGrantsWithPage.
@Test
public void shouldListClientGrantsWithPage() throws Exception {
ClientGrantsFilter filter = new ClientGrantsFilter().withPage(23, 5);
Request<ClientGrantsPage> request = api.clientGrants().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CLIENT_GRANTS_LIST, 200);
ClientGrantsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/client-grants"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("page", "23"));
assertThat(recordedRequest, hasQueryParameter("per_page", "5"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
use of com.auth0.net.Request in project auth0-java by auth0.
the class ClientGrantsEntityTest method shouldListClientGrantsWithoutFilter.
@Test
public void shouldListClientGrantsWithoutFilter() throws Exception {
Request<ClientGrantsPage> request = api.clientGrants().list(null);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CLIENT_GRANTS_LIST, 200);
ClientGrantsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/client-grants"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
use of com.auth0.net.Request in project auth0-java by auth0.
the class ClientsEntityTest method shouldListClientsWithoutFilter.
@Test
public void shouldListClientsWithoutFilter() throws Exception {
Request<ClientsPage> request = api.clients().list(null);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CLIENTS_LIST, 200);
ClientsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/clients"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
use of com.auth0.net.Request in project auth0-java by auth0.
the class ClientsEntityTest method shouldListClientsWithFields.
@Test
public void shouldListClientsWithFields() throws Exception {
ClientFilter filter = new ClientFilter().withFields("some,random,fields", true);
Request<ClientsPage> request = api.clients().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CLIENTS_PAGED_LIST, 200);
ClientsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/clients"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("fields", "some,random,fields"));
assertThat(recordedRequest, hasQueryParameter("include_fields", "true"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
use of com.auth0.net.Request in project auth0-java by auth0.
the class ClientsEntityTest method shouldGetClient.
@Test
public void shouldGetClient() throws Exception {
Request<Client> request = api.clients().get("1");
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CLIENT, 200);
Client response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/clients/1"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
}
Aggregations