Skip to content

Commit

Permalink
chore: fix broken tests from DHIS2-17906 (#18476)
Browse files Browse the repository at this point in the history
* chore: fix broken tests from DHIS2-17906
  • Loading branch information
netroms authored Aug 28, 2024
1 parent 5365ee4 commit 49942a2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import static org.hisp.dhis.analytics.DataQueryParams.DISPLAY_NAME_ORGUNIT;
import static org.hisp.dhis.period.RelativePeriodEnum.THIS_QUARTER;
import static org.hisp.dhis.test.TestBase.createDataElement;
import static org.hisp.dhis.test.TestBase.injectSecurityContext;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
Expand Down Expand Up @@ -64,6 +65,7 @@
import org.hisp.dhis.period.MonthlyPeriodType;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.YearlyPeriodType;
import org.hisp.dhis.user.SystemUser;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -74,6 +76,7 @@
class AnalyticsServiceMetadataTest extends AnalyticsServiceBaseTest {
@BeforeEach
public void setUp() {
injectSecurityContext(new SystemUser());
Map<String, Object> aggregatedValues = new HashMap<>();
when(analyticsManager.getAggregatedDataValues(
any(DataQueryParams.class), eq(AnalyticsTableType.DATA_VALUE), eq(0)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hisp.dhis.test.TestBase.createDataSet;
import static org.hisp.dhis.test.TestBase.injectSecurityContext;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.ArgumentMatchers.any;
Expand Down Expand Up @@ -59,13 +60,20 @@
import org.hisp.dhis.period.MonthlyPeriodType;
import org.hisp.dhis.period.PeriodType;
import org.hisp.dhis.period.PeriodTypeEnum;
import org.hisp.dhis.user.SystemUser;
import org.joda.time.DateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

/**
* @author Luciano Fiandesio
*/
class AnalyticsServiceReportingRateTest extends AnalyticsServiceBaseTest {
@BeforeEach
public void setUp() {
injectSecurityContext(new SystemUser());
}

@Test
void verifyReportingRatesValueWhenPeriodIsFilter() {
int timeUnit = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,8 @@ void testGetPeriodDimensionForNonIsoPeriod() {

@Test
void testDynamicFrom() {
injectSecurityContext(new SystemUser());

String categoryUid = "L6BswcbPGqs";
String categoryName = "Category-A";
Category category = createCategory(categoryName, categoryUid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dxf2.common.OrderParams;
import org.hisp.dhis.indicator.Indicator;
import org.hisp.dhis.user.SystemUser;
import org.hisp.dhis.user.User;
import org.hisp.dhis.user.UserDetails;
import org.hisp.dhis.user.UserService;
Expand Down Expand Up @@ -88,6 +89,7 @@ class DataItemServiceFacadeTest {

@BeforeEach
public void setUp() {
injectSecurityContext(new SystemUser());
dataItemServiceFacade = new DataItemServiceFacade(userService, queryExecutor);
}

Expand Down

0 comments on commit 49942a2

Please sign in to comment.