Skip to content

Commit

Permalink
chore: add regression test for DHIS2-11655 (dhis2#9095)
Browse files Browse the repository at this point in the history
  • Loading branch information
teleivo authored Oct 26, 2021
1 parent 9405f09 commit f79c5d5
Showing 1 changed file with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@
*/
package org.hisp.dhis.tracker.importer;

import static org.hamcrest.Matchers.*;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.emptyIterable;
import static org.hamcrest.Matchers.everyItem;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -38,6 +44,7 @@
import org.hisp.dhis.dto.TrackerApiResponse;
import org.hisp.dhis.tracker.TrackerNtiApiTest;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
Expand Down Expand Up @@ -132,4 +139,26 @@ private List<String> splitFields( String fields )

return split;
}

@Test
public void shouldReturnSingleTeiGivenFilter()
{

trackerActions.get("trackedEntities?orgUnit=O6uvpzGd5pu&program=f1AyMswryyQ&filter=kZeSYCgaHTk:in:Bravo")
.validate()
.statusCode(200)
.body("instances.findAll { it.trackedEntity == 'Kj6vYde4LHh' }.size()", is(1))
.body("instances.attributes.flatten().findAll { it.attribute == 'kZeSYCgaHTk' }.value", everyItem(is("Bravo")));
}

@Test
public void shouldReturnSingleTeiGivenFilterWhileSkippingPaging()
{

trackerActions.get("trackedEntities?skipPaging=true&orgUnit=O6uvpzGd5pu&program=f1AyMswryyQ&filter=kZeSYCgaHTk:in:Bravo")
.validate()
.statusCode(200)
.body("instances.findAll { it.trackedEntity == 'Kj6vYde4LHh' }.size()", is(1))
.body("instances.attributes.flatten().findAll { it.attribute == 'kZeSYCgaHTk' }.value", everyItem(is("Bravo")));
}
}

0 comments on commit f79c5d5

Please sign in to comment.