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"));
}
Aggregations