use of com.auth0.net.Request 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.net.Request 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.net.Request in project auth0-java by auth0.
the class OrganizationEntityTest method shouldGetInvitationWithFilter.
@Test
public void shouldGetInvitationWithFilter() throws Exception {
Request<Invitation> request = api.organizations().getInvitation("org_123", "invitation_id", new FieldsFilter().withFields("id,invitation_url,invitee", true));
assertThat(request, is(notNullValue()));
server.jsonResponse(INVITATION, 200);
Invitation response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_123/invitations/invitation_id"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("fields", "id,invitation_url,invitee"));
assertThat(recordedRequest, hasQueryParameter("include_fields", "true"));
assertThat(response, is(notNullValue()));
}
use of com.auth0.net.Request in project auth0-java by auth0.
the class OrganizationEntityTest method shouldGetOrgRolesWithoutPaging.
@Test
public void shouldGetOrgRolesWithoutPaging() throws Exception {
Request<RolesPage> request = api.organizations().getRoles("org_abc", "user_123", null);
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(response, is(notNullValue()));
assertThat(response.getItems(), hasSize(1));
}
use of com.auth0.net.Request 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()));
}
Aggregations