use of com.auth0.json.mgmt.RulesConfig in project auth0-java by auth0.
the class RulesConfigsEntityTest method shouldUpdateRulesConfig.
@Test
public void shouldUpdateRulesConfig() throws Exception {
Request<RulesConfig> request = api.rulesConfigs().update("1", new RulesConfig("my-value"));
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_CONNECTION, 200);
RulesConfig response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("PUT", "/api/v2/rules-configs/1"));
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("value", "my-value"));
assertThat(response, is(notNullValue()));
}
use of com.auth0.json.mgmt.RulesConfig in project auth0-java by auth0.
the class RulesConfigsEntityTest method shouldListRules.
@Test
public void shouldListRules() throws Exception {
Request<List<RulesConfig>> request = api.rulesConfigs().list();
assertThat(request, is(notNullValue()));
server.jsonResponse(MGMT_RULES_CONFIGS_LIST, 200);
List<RulesConfig> response = request.execute();
RecordedRequest recordedRequest = server.takeRequest();
assertThat(recordedRequest, hasMethodAndPath("GET", "/api/v2/rules-configs"));
assertThat(recordedRequest, hasHeader("Content-Type", "application/json"));
assertThat(recordedRequest, hasHeader("Authorization", "Bearer apiToken"));
assertThat(response, is(notNullValue()));
assertThat(response, hasSize(2));
}
use of com.auth0.json.mgmt.RulesConfig in project auth0-java by auth0.
the class RulesConfigsEntityTest method shouldThrowOnUpdateRulesConfigWithNullKey.
@Test
public void shouldThrowOnUpdateRulesConfigWithNullKey() {
exception.expect(IllegalArgumentException.class);
exception.expectMessage("'rules config key' cannot be null!");
api.rulesConfigs().update(null, new RulesConfig("my-value"));
}
Aggregations