Search in sources :

Example 1 with InvitationsFilter

use of com.auth0.client.mgmt.filter.InvitationsFilter in project auth0-java by auth0.

the class OrganizationEntityTest method shouldGetInvitationsWithFilter.

@Test
public void shouldGetInvitationsWithFilter() throws Exception {
    InvitationsFilter filter = new InvitationsFilter().withSort("created_at:1").withFields("invitee,inviter,created_at", true);
    Request<InvitationsPage> request = api.organizations().getInvitations("org_123", filter);
    assertThat(request, is(notNullValue()));
    server.jsonResponse(INVITATIONS_LIST, 200);
    InvitationsPage response = request.execute();
    RecordedRequest recordedRequest = server.takeRequest();
    assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_123/invitations"));
    assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
    assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
    assertThat(recordedRequest, hasQueryParameter("fields", "invitee,inviter,created_at"));
    assertThat(recordedRequest, hasQueryParameter("include_fields", "true"));
    assertThat(recordedRequest, hasQueryParameter("sort", "created_at:1"));
    assertThat(response, is(notNullValue()));
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) InvitationsFilter(com.auth0.client.mgmt.filter.InvitationsFilter) Test(org.junit.Test)

Example 2 with InvitationsFilter

use of com.auth0.client.mgmt.filter.InvitationsFilter in project auth0-java by auth0.

the class OrganizationEntityTest method shouldGetInvitationsWithTotals.

@Test
public void shouldGetInvitationsWithTotals() throws Exception {
    InvitationsFilter filter = new InvitationsFilter().withTotals(true);
    Request<InvitationsPage> request = api.organizations().getInvitations("org_123", filter);
    assertThat(request, is(notNullValue()));
    server.jsonResponse(INVITATIONS_PAGED_LIST, 200);
    InvitationsPage response = request.execute();
    RecordedRequest recordedRequest = server.takeRequest();
    assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_123/invitations"));
    assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
    assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
    assertThat(recordedRequest, hasQueryParameter("include_totals", "true"));
    assertThat(response, is(notNullValue()));
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) InvitationsFilter(com.auth0.client.mgmt.filter.InvitationsFilter) Test(org.junit.Test)

Example 3 with InvitationsFilter

use of com.auth0.client.mgmt.filter.InvitationsFilter in project auth0-java by auth0.

the class OrganizationEntityTest method shouldGetInvitationsWithPaging.

@Test
public void shouldGetInvitationsWithPaging() throws Exception {
    InvitationsFilter filter = new InvitationsFilter().withPage(0, 20);
    Request<InvitationsPage> request = api.organizations().getInvitations("org_123", filter);
    assertThat(request, is(notNullValue()));
    server.jsonResponse(INVITATIONS_LIST, 200);
    InvitationsPage response = request.execute();
    RecordedRequest recordedRequest = server.takeRequest();
    assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/organizations/org_123/invitations"));
    assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
    assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
    assertThat(recordedRequest, hasQueryParameter("per_page", "20"));
    assertThat(recordedRequest, hasQueryParameter("page", "0"));
    assertThat(response, is(notNullValue()));
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) InvitationsFilter(com.auth0.client.mgmt.filter.InvitationsFilter) Test(org.junit.Test)

Aggregations

InvitationsFilter (com.auth0.client.mgmt.filter.InvitationsFilter)3 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)3 Test (org.junit.Test)3