Search in sources :

Example 1 with AuditActions

use of org.hisp.dhis.actions.AuditActions in project dhis2-core by dhis2.

the class PotentialDuplicatesAttributeMergeTests method shouldMoveChangelogs.

@Test
public void shouldMoveChangelogs() {
    String teiA = createTeiWithAttributes(createAttribute(attributes.get(0), "attribute A"));
    String teiB = createTeiWithAttributes(createAttribute(attributes.get(0), "attribute A - changed"), createAttribute(attributes.get(1), "attribute B"));
    String potentialDuplicate = potentialDuplicatesActions.createAndValidatePotentialDuplicate(teiA, teiB, "OPEN");
    potentialDuplicatesActions.manualMergePotentialDuplicate(potentialDuplicate, new JsonObjectBuilder().addArray("trackedEntityAttributes", Arrays.asList(attributes.get(0), attributes.get(1))).build()).validate().statusCode(200);
    new AuditActions().getTrackedEntityAttributeValueAudits(teiA).validate().statusCode(200).rootPath("trackedEntityAttributeValueAudits").body("", hasSize(greaterThanOrEqualTo(2))).appendRootPath(String.format("find{it.trackedEntityAttribute.id=='%s'}", attributes.get(1))).body("value", equalTo("attribute B")).body("auditType", equalTo("CREATE")).rootPath(String.format("trackedEntityAttributeValueAudits.find{it.trackedEntityAttribute.id=='%s'}", attributes.get(0))).body("value", equalTo("attribute A - changed")).body("auditType", equalTo("UPDATE"));
}
Also used : AuditActions(org.hisp.dhis.actions.AuditActions) JsonObjectBuilder(org.hisp.dhis.helpers.JsonObjectBuilder) PotentialDuplicatesApiTest(org.hisp.dhis.tracker.deduplication.PotentialDuplicatesApiTest) Test(org.junit.jupiter.api.Test)

Aggregations

AuditActions (org.hisp.dhis.actions.AuditActions)1 JsonObjectBuilder (org.hisp.dhis.helpers.JsonObjectBuilder)1 PotentialDuplicatesApiTest (org.hisp.dhis.tracker.deduplication.PotentialDuplicatesApiTest)1 Test (org.junit.jupiter.api.Test)1