use of org.entando.entando.web.dataobjectmodel.validator.DataObjectModelValidator in project entando-core by entando.
the class DataObjectModelControllerTest method should_validate_put_path_mismatch.
@Test
public void should_validate_put_path_mismatch() throws ApsSystemException, Exception {
UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24").grantedToRoleAdmin().build();
String accessToken = mockOAuthInterceptor(user);
ObjectMapper mapper = new ObjectMapper();
DataObjectModelRequest group = new DataObjectModelRequest();
group.setModelId("2l");
group.setDescr("Description");
group.setType("AAA");
group.setModel("<p>Test</p>");
String payload = mapper.writeValueAsString(group);
this.controller.setDataObjectModelValidator(new DataObjectModelValidator());
ResultActions result = mockMvc.perform(put("/dataModels/{dataModelId}", "67").content(payload).contentType(MediaType.APPLICATION_JSON).header("Authorization", "Bearer " + accessToken));
result.andExpect(status().isBadRequest());
}
Aggregations