use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class MetadataExportTests method shouldNotExportUserMetadataWithoutAuthority.
@Test
public void shouldNotExportUserMetadataWithoutAuthority() {
loginActions.loginAsUser(userWithoutAccessUsername, userWithoutAccessPassword);
metadataActions.get("", new QueryParamsBuilder().add("users=true")).validate().statusCode(409).body("message", equalTo("Exporting user metadata requires the 'F_USER_VIEW' authority."));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class PotentialDuplicatesTests method shouldFilterByStatus.
@ParameterizedTest
@ValueSource(strings = { "OPEN", "INVALID", "MERGED" })
public void shouldFilterByStatus(String status) {
String teiA = createTei();
String teiB = createTei();
potentialDuplicatesActions.createPotentialDuplicate(teiA, teiB, status).validate().statusCode(200);
ApiResponse response = potentialDuplicatesActions.get("", new QueryParamsBuilder().add("status=" + status));
response.validate().body("identifiableObjects", hasSize(greaterThanOrEqualTo(1))).body("identifiableObjects.status", everyItem(equalTo(status)));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder in project dhis2-core by dhis2.
the class PotentialDuplicatesTests method shouldReturnAllStatuses.
@Test
public void shouldReturnAllStatuses() {
Arrays.asList("OPEN", "MERGED", "INVALID").forEach(status -> {
String teiA = createTei();
String teiB = createTei();
potentialDuplicatesActions.createPotentialDuplicate(teiA, teiB, status).validate().statusCode(200);
});
potentialDuplicatesActions.get("", new QueryParamsBuilder().add("status=ALL")).validate().body("identifiableObjects", hasSize(greaterThanOrEqualTo(1))).body("identifiableObjects.status", allOf(hasItem("OPEN"), hasItem("INVALID"), hasItem("MERGED")));
}
use of org.hisp.dhis.helpers.QueryParamsBuilder 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.helpers.QueryParamsBuilder 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"));
}
Aggregations