use of org.hisp.dhis.dto.TrackerApiResponse in project dhis2-core by dhis2.
the class RuleEngineTests method shouldAssignValue.
@Test
public void shouldAssignValue() {
JsonObject payload = new EventDataBuilder().array(Constants.ORG_UNIT_IDS[0], eventProgramId, "Mt6Ac5brjoK");
TrackerApiResponse response = trackerActions.postAndGetJobReport(payload, new QueryParamsBuilder().addAll("skipSideEffects=true"));
response.validateSuccessfulImport().validateWarningReport().body("warningCode", contains("E1308"));
String eventId = response.extractImportedEvents().get(0);
trackerActions.get("/events/" + eventId).validate().body("dataValues", hasSize(1)).body("dataValues.value", contains("AUTO_ASSIGNED_COMMENT"));
}
use of org.hisp.dhis.dto.TrackerApiResponse in project dhis2-core by dhis2.
the class RuleEngineTests method shouldImportWhenWarnings.
@Test
public void shouldImportWhenWarnings() {
// arrange
JsonObject object = new TeiDataBuilder().buildWithEnrollmentAndEvent(Constants.TRACKED_ENTITY_TYPE, Constants.ORG_UNIT_IDS[0], trackerProgramId, "yKg8CY252Yk");
JsonObjectBuilder.jsonObject(object).addPropertyByJsonPath("trackedEntities[0].enrollments[0].enrolledAt", Instant.now().minus(1, ChronoUnit.DAYS).toString());
// act
TrackerApiResponse response = trackerActions.postAndGetJobReport(object);
response.validateWarningReport().body("message[0]", containsString("TA warning")).body("warningCode", everyItem(equalTo("E1300")));
response.validateSuccessfulImport();
}
use of org.hisp.dhis.dto.TrackerApiResponse in project dhis2-core by dhis2.
the class TrackerExportTests method singleTeiAndCollectionTeiShouldReturnSameResult.
@Test
public void singleTeiAndCollectionTeiShouldReturnSameResult() throws JSONException {
TrackerApiResponse trackedEntity = trackerActions.getTrackedEntity("Kj6vYde4LHh", new QueryParamsBuilder().add("fields", "*").add("includeAllAttributes", "true"));
TrackerApiResponse trackedEntities = trackerActions.getTrackedEntities(new QueryParamsBuilder().add("fields", "*").add("includeAllAttributes", "true").add("trackedEntity", "Kj6vYde4LHh").add("orgUnit", "O6uvpzGd5pu"));
JSONAssert.assertEquals(trackedEntity.getBody().toString(), trackedEntities.extractJsonObject("instances[0]").toString(), false);
}
use of org.hisp.dhis.dto.TrackerApiResponse in project dhis2-core by dhis2.
the class TrackerExportTests method beforeAll.
@BeforeAll
public void beforeAll() throws Exception {
loginActions.loginAsSuperUser();
TrackerApiResponse response = importTeiWithEnrollmentAndEvent();
teiId = response.validateSuccessfulImport().extractImportedTeis().get(0);
enrollmentId = response.extractImportedEnrollments().get(0);
relationshipId = response.extractImportedRelationships().get(0);
eventId = response.extractImportedEvents().get(0);
}
use of org.hisp.dhis.dto.TrackerApiResponse in project dhis2-core by dhis2.
the class AtomicModeTests method shouldImportWhenErrorsWithAtomicMode.
@Test
public void shouldImportWhenErrorsWithAtomicMode() throws Exception {
TrackerApiResponse response = trackerActions.postAndGetJobReport(createWrongPayload(), new QueryParamsBuilder().addAll("atomicMode=OBJECT"));
response.validate().body("status", equalTo("OK")).body("stats.ignored", equalTo(2)).body("stats.created", equalTo(1));
response.validateErrorReport().body("", hasSize(2)).body("trackerType", contains("TRACKED_ENTITY", "RELATIONSHIP"));
}
Aggregations