use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class EventImportDataValueValidationTests method shouldNotValidateDataValuesOnUpdateWithOnCompleteStrategy.
@Test
public void shouldNotValidateDataValuesOnUpdateWithOnCompleteStrategy() {
programActions.programStageActions.setValidationStrategy(programStageId, "ON_COMPLETE");
JsonObject events = eventActions.createEventBody(OU_ID, programId, programStageId);
ApiResponse response = eventActions.post(events, new QueryParamsBuilder().add("skipCache=true"));
response.validate().statusCode(200).body("status", equalTo("OK")).body("response.ignored", equalTo(0)).body("response.imported", equalTo(1));
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class EventImportDataValueValidationTests method shouldValidateDataValuesOnCompleteWhenEventIsCompleted.
@Test
public void shouldValidateDataValuesOnCompleteWhenEventIsCompleted() {
programActions.programStageActions.setValidationStrategy(programStageId, "ON_COMPLETE");
JsonObject event = eventActions.createEventBody(OU_ID, programId, programStageId);
event.addProperty("status", "COMPLETED");
ApiResponse response = eventActions.post(event, new QueryParamsBuilder().add("skipCache=true"));
response.validate().statusCode(409).body("status", equalTo("ERROR")).rootPath("response").body("ignored", equalTo(1)).body("imported", equalTo(0)).body("importSummaries[0].conflicts[0].value", equalTo("value_required_but_not_provided"));
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class EventImportDataValueValidationTests method shouldValidateDataValuesOnUpdate.
@Test
public void shouldValidateDataValuesOnUpdate() {
programActions.programStageActions.setValidationStrategy(programStageId, "ON_UPDATE_AND_INSERT");
JsonObject events = eventActions.createEventBody(OU_ID, programId, programStageId);
ApiResponse response = eventActions.post(events, new QueryParamsBuilder().add("skipCache=true"));
response.validate().statusCode(409).body("status", equalTo("ERROR")).rootPath("response").body("ignored", equalTo(1)).body("imported", equalTo(0)).body("importSummaries[0].conflicts[0].value", equalTo("value_required_but_not_provided"));
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class AbstractOrgUnitAssociationTestSupport method validateResponseHasKey.
private ApiResponse validateResponseHasKey(Function<String, ApiResponse> apiResponseProvider, String key) {
ApiResponse apiResponse = apiResponseProvider.apply(key);
apiResponse.validate().body("$", hasKey(key));
return apiResponse;
}
use of org.hisp.dhis.dto.ApiResponse in project dhis2-core by dhis2.
the class UserLookupTests method shouldLookupSpecificUser.
@ParameterizedTest
@CsvSource({ "PQD6wXJ2r5j,id", "taadmin,username" })
public void shouldLookupSpecificUser(String resource, String propertyToValidate) {
ApiResponse response = lookupActions.get(resource);
response.validate().statusCode(200).body(propertyToValidate, equalTo(resource)).body("id", notNullValue()).body("username", notNullValue()).body("firstName", notNullValue()).body("surname", notNullValue()).body("displayName", notNullValue());
}
Aggregations