use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class OrganizationEntityTest method shouldListOrgMembersWithPage.
@Test
public void shouldListOrgMembersWithPage() throws Exception {
PageFilter filter = new PageFilter().withPage(0, 20);
Request<MembersPage> request = api.organizations().getMembers("org_abc", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MockServer.ORGANIZATION_MEMBERS_LIST, 200);
MembersPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_abc/members"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("page", "0"));
assertThat(recordedRequest, hasQueryParameter("per_page", "20"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(3));
}
use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class OrganizationEntityTest method shouldListOrgMembersWithCheckpointPageResponse.
@Test
public void shouldListOrgMembersWithCheckpointPageResponse() throws Exception {
PageFilter filter = new PageFilter().withTake(3).withFrom("from-pointer");
Request<MembersPage> request = api.organizations().getMembers("org_abc", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(ORGANIZATION_MEMBERS_CHECKPOINT_PAGED_LIST, 200);
MembersPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_abc/members"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("take", "3"));
assertThat(recordedRequest, hasQueryParameter("from", "from-pointer"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(3));
}
use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class OrganizationEntityTest method shouldGetOrganizationConnectionsWithPage.
@Test
public void shouldGetOrganizationConnectionsWithPage() throws Exception {
PageFilter filter = new PageFilter().withPage(2, 30);
Request<EnabledConnectionsPage> request = api.organizations().getConnections("org_abc", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MockServer.ORGANIZATION_CONNECTIONS_LIST, 200);
EnabledConnectionsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_abc/enabled_connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("page", "2"));
assertThat(recordedRequest, hasQueryParameter("per_page", "30"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(2));
}
use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class OrganizationEntityTest method shouldListOrgMembersWithTotals.
@Test
public void shouldListOrgMembersWithTotals() throws Exception {
PageFilter filter = new PageFilter().withTotals(true);
Request<MembersPage> request = api.organizations().getMembers("org_abc", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MockServer.ORGANIZATION_MEMBERS_PAGED_LIST, 200);
MembersPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_abc/members"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("include_totals", "true"));
assertThat(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(3));
}
use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class ActionsEntityTest method shouldGetTriggerBindingsWithFilter.
@Test
public void shouldGetTriggerBindingsWithFilter() throws Exception {
PageFilter filter = new PageFilter().withPage(1, 10);
Request<BindingsPage> request = api.actions().getTriggerBindings("trigger-id", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MockServer.ACTION_TRIGGER_BINDINGS, 200);
BindingsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/actions/triggers/trigger-id/bindings"));
assertThat(recordedRequest, hasQueryParameter("page", "1"));
assertThat(recordedRequest, hasQueryParameter("per_page", "10"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
}
Aggregations