Skip to content

Commit

Permalink
fix: Remove unused method & test [DHIS2-17335]
Browse files Browse the repository at this point in the history
  • Loading branch information
muilpp committed Dec 12, 2024
1 parent 6318f29 commit c44e588
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -230,13 +230,6 @@ public boolean needsToRun(TrackerImportStrategy strategy) {
return true;
}

private void checkOrgUnitInCaptureScope(
Reporter reporter, TrackerDto dto, OrganisationUnit orgUnit, UserDetails user) {
if (!user.isInUserHierarchy(orgUnit.getPath())) {
reporter.addError(dto, ValidationCode.E1000, user, orgUnit);
}
}

private void checkTeTypeAndTeProgramAccess(
Reporter reporter,
TrackerDto dto,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -485,42 +485,6 @@ void verifySuccessEventValidationWhenEventHasNoOrgUnitAssigned() {
assertIsEmpty(reporter.getErrors());
}

@Test
void shouldSucceedWhenScheduledEventIsCreatedFromSearchOrgUnit() {
UID enrollmentUid = UID.generate();
org.hisp.dhis.tracker.imports.domain.Event event =
org.hisp.dhis.tracker.imports.domain.Event.builder()
.event(UID.generate())
.enrollment(enrollmentUid)
.orgUnit(MetadataIdentifier.ofUid(ORG_UNIT_ID))
.programStage(MetadataIdentifier.ofUid(PS_ID))
.program(MetadataIdentifier.ofUid(PROGRAM_ID))
.status(EventStatus.SCHEDULE)
.build();

when(bundle.getPreheat()).thenReturn(preheat);
when(bundle.getStrategy(event)).thenReturn(TrackerImportStrategy.CREATE);
Enrollment enrollment = getEnrollment(enrollmentUid);

Event preheatEvent = getEvent();
preheatEvent.setEnrollment(enrollment);
preheatEvent.setOrganisationUnit(null);

when(preheat.getEvent(event.getEvent())).thenReturn(preheatEvent);
when(preheat.getProgram(MetadataIdentifier.ofUid(PROGRAM_ID))).thenReturn(program);
when(preheat.getProgramStage(MetadataIdentifier.ofUid(PS_ID))).thenReturn(programStage);
when(preheat.getOrganisationUnit(MetadataIdentifier.ofUid(ORG_UNIT_ID)))
.thenReturn(organisationUnit);

when(aclService.canDataRead(user, program.getTrackedEntityType())).thenReturn(true);
when(aclService.canDataRead(user, program)).thenReturn(true);
when(aclService.canDataWrite(user, programStage)).thenReturn(true);

validator.validate(reporter, bundle, event);

assertIsEmpty(reporter.getErrors());
}

private TrackedEntity teWithNoEnrollments() {
TrackedEntity trackedEntity = createTrackedEntity(organisationUnit);
trackedEntity.setUid(TE_ID.getValue());
Expand Down

0 comments on commit c44e588

Please sign in to comment.