use of com.auth0.client.mgmt.filter.ConnectionFilter in project auth0-java by auth0.
the class ConnectionsEntityTest method shouldListConnectionsWithStrategy.
@Test
public void shouldListConnectionsWithStrategy() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withStrategy("auth0");
@SuppressWarnings("deprecation") Request<List<Connection>> request = api.connections().list(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTIONS_LIST, 200);
List<Connection> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("strategy", "auth0"));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(2));
}
use of com.auth0.client.mgmt.filter.ConnectionFilter in project auth0-java by auth0.
the class ConnectionsEntityTest method shouldGetConnectionWithFields.
@Test
public void shouldGetConnectionWithFields() throws Exception {
ConnectionFilter filter = new ConnectionFilter().withFields("some,random,fields", true);
Request<Connection> request = api.connections().get("1", filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
Connection response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/connections/1"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(recordedRequest, hasQueryParameter("fields", "some,random,fields"));
assertThat(recordedRequest, hasQueryParameter("include_fields", "true"));
assertThat(response, is(notNullValue()));
}
Aggregations