Search in sources :

Example 6 with ApiConsumer

use of org.entando.entando.aps.system.services.oauth2.model.ApiConsumer in project entando-core by entando.

the class ApiConsumerControllerTest method testValidationErrorPost.

private ResultActions testValidationErrorPost(Consumer<ApiConsumer> consumer) throws Exception {
    ApiConsumer apiConsumer = getValidPayload();
    consumer.accept(apiConsumer);
    ResultActions result = authRequest(post(BASE_URL).content(jsonMapper.writeValueAsString(apiConsumer)));
    result.andExpect(status().is4xxClientError()).andExpect(jsonPath("$.errors", hasSize(1)));
    return result;
}
Also used : ApiConsumer(org.entando.entando.aps.system.services.oauth2.model.ApiConsumer) ResultActions(org.springframework.test.web.servlet.ResultActions)

Example 7 with ApiConsumer

use of org.entando.entando.aps.system.services.oauth2.model.ApiConsumer in project entando-core by entando.

the class ApiConsumerControllerTest method getValidPayload.

private ApiConsumer getValidPayload() {
    ApiConsumer apiConsumer = new ApiConsumer();
    apiConsumer.setKey("valid_key");
    apiConsumer.setName("name");
    apiConsumer.setSecret("secret");
    apiConsumer.setDescription("description");
    apiConsumer.setExpirationDate("2020-01-01 00:00:00");
    return apiConsumer;
}
Also used : ApiConsumer(org.entando.entando.aps.system.services.oauth2.model.ApiConsumer)

Aggregations

ApiConsumer (org.entando.entando.aps.system.services.oauth2.model.ApiConsumer)7 ResultActions (org.springframework.test.web.servlet.ResultActions)3 Test (org.junit.Test)2 ResourceNotFoundException (org.entando.entando.aps.system.exception.ResourceNotFoundException)1 ConsumerRecordVO (org.entando.entando.aps.system.services.oauth2.model.ConsumerRecordVO)1 AbstractControllerIntegrationTest (org.entando.entando.web.AbstractControllerIntegrationTest)1 AbstractControllerTest (org.entando.entando.web.AbstractControllerTest)1