use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class OrganizationEntityTest method shouldGetOrgRolesWithPaging.
@Test
public void shouldGetOrgRolesWithPaging() throws Exception {
Request<RolesPage> request = api.organizations().getRoles("org_abc", "user_123", new PageFilter().withPage(0, 20));
assertThat(request, is(notNullValue()));
server.jsonResponse(ORGANIZATION_MEMBER_ROLES_LIST, 200);
RolesPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_abc/members/user_123/roles"));
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(1));
}
use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class OrganizationEntityTest method shouldGetOrgRolesWithIncludeTotals.
@Test
public void shouldGetOrgRolesWithIncludeTotals() throws Exception {
Request<RolesPage> request = api.organizations().getRoles("org_abc", "user_123", new PageFilter().withTotals(true));
assertThat(request, is(notNullValue()));
server.jsonResponse(ORGANIZATION_MEMBER_ROLES_PAGED_LIST, 200);
RolesPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_abc/members/user_123/roles"));
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(1));
}
use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class ActionsEntityTest method shouldGetActionVersionsWithFilter.
@Test
public void shouldGetActionVersionsWithFilter() throws Exception {
PageFilter filter = new PageFilter().withPage(1, 10);
Request<VersionsPage> request = api.actions().getVersions("action-id", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MockServer.ACTION_VERSIONS_LIST, 200);
VersionsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/actions/actions/action-id/versions"));
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()));
}
use of com.auth0.client.mgmt.filter.PageFilter in project auth0-java by auth0.
the class OrganizationEntityTest method shouldListOrgsWithPage.
@Test
public void shouldListOrgsWithPage() throws Exception {
PageFilter filter = new PageFilter().withPage(2, 30);
Request<OrganizationsPage> request = api.organizations().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MockServer.ORGANIZATIONS_PAGED_LIST, 200);
OrganizationsPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations"));
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 RolesEntityTest method shouldListUsersWithPage.
@Test
public void shouldListUsersWithPage() throws Exception {
PageFilter filter = new PageFilter().withPage(23, 5);
Request<UsersPage> request = api.roles().listUsers("1", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_ROLE_USERS_PAGED_LIST, 200);
UsersPage response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/roles/1/users"));
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));
}
Aggregations