use of com.auth0.json.mgmt.emailproviders.EmailProvider in project auth0-java by auth0.
the class EmailProviderEntityTest method shouldGetEmailProvider.
@Test
public void shouldGetEmailProvider() throws Exception {
Request<EmailProvider> request = api.emailProvider().get(null);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_EMAIL_PROVIDER, 200);
EmailProvider response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/emails/provider"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
}
use of com.auth0.json.mgmt.emailproviders.EmailProvider in project auth0-java by auth0.
the class EmailProviderEntityTest method shouldSetupEmailProvider.
@Test
public void shouldSetupEmailProvider() throws Exception {
Request<EmailProvider> request = api.emailProvider().setup(new EmailProvider("provider"));
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_EMAIL_PROVIDER, 200);
EmailProvider response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("POST", "/api/v2/emails/provider"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body.size(), is(1));
assertThat(body, hasEntry("name", "provider"));
assertThat(response, is(notNullValue()));
}
use of com.auth0.json.mgmt.emailproviders.EmailProvider in project auth0-java by auth0.
the class EmailProviderEntityTest method shouldGetEmailProviderWithFields.
@Test
public void shouldGetEmailProviderWithFields() throws Exception {
FieldsFilter filter = new FieldsFilter().withFields("some,random,fields", true);
Request<EmailProvider> request = api.emailProvider().get(filter);
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_EMAIL_PROVIDER, 200);
EmailProvider response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/emails/provider"));
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()));
}
use of com.auth0.json.mgmt.emailproviders.EmailProvider in project auth0-java by auth0.
the class EmailProviderEntityTest method shouldUpdateEmailProvider.
@Test
public void shouldUpdateEmailProvider() throws Exception {
Request<EmailProvider> request = api.emailProvider().update(new EmailProvider("name"));
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_EMAIL_PROVIDER, 200);
EmailProvider response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("PATCH", "/api/v2/emails/provider"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
Map<String, Object> body = bodyFromRequest(recordedRequest);
assertThat(body.size(), is(1));
assertThat(body, hasEntry("name", "name"));
assertThat(response, is(notNullValue()));
}
Aggregations