Search in sources :

Example 1 with ActionsFilter

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

the class ActionsEntityTest method shouldListActionsWithFilter.

@Test
public void shouldListActionsWithFilter() throws Exception {
    ActionsFilter filter = new ActionsFilter().withActionName("action-name").withDeployed(true).withInstalled(false).withTriggerId("post-login").withPage(1, 10);
    Request<ActionsPage> request = api.actions().list(filter);
    assertThat(request, is(notNullValue()));
    server.jsonResponse(MockServer.ACTIONS_LIST, 200);
    ActionsPage response = request.execute();
    RecordedRequest recordedRequest = server.takeRequest();
    assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/actions/actions"));
    assertThat(recordedRequest, hasQueryParameter("actionName", "action-name"));
    assertThat(recordedRequest, hasQueryParameter("deployed", "true"));
    assertThat(recordedRequest, hasQueryParameter("installed", "false"));
    assertThat(recordedRequest, hasQueryParameter("triggerId", "post-login"));
    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()));
}
Also used : RecordedRequest(okhttp3.mockwebserver.RecordedRequest) ActionsFilter(com.auth0.client.mgmt.filter.ActionsFilter) Test(org.junit.Test)

Aggregations

ActionsFilter (com.auth0.client.mgmt.filter.ActionsFilter)1 RecordedRequest (okhttp3.mockwebserver.RecordedRequest)1 Test (org.junit.Test)1