Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: align fetching a single vs multiple enrollments [DHIS2-18791] #19705

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

enricocolasante
Copy link
Contributor

@enricocolasante enricocolasante commented Jan 17, 2025

Use the same path to retrieve one enrollment and multiple enrollments.
In order to achieve that when getting one enrollment we are using the get multiple enrollments method and return a NotFoundException if something goes wrong (this is sometimes replacing the previous ForbiddenException because the multiple enrollment method is filtering out inaccessible enrollments. This is working the same way in event exporter).

Other changes

  • Assign ACCESSIBLE as default value to orgUnitMode in EnrollmentOperationParams.
  • Use UserDetails.fromUser to properly initialize search and capture scope for users in tests.
  • Fixing tests inject user with the right scope.
  • Fixing tests to assert the right exception. (NotFoundException instead of ForbiddenException)

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 82.05128% with 7 lines in your changes missing coverage. Please review.

Project coverage is 67.39%. Comparing base (73ccf63) to head (22e50cc).
Report is 10 commits behind head on master.

Files with missing lines Patch % Lines
...er/export/enrollment/DefaultEnrollmentService.java 83.78% 6 Missing ⚠️
...est/src/main/java/org/hisp/dhis/test/TestBase.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             master   #19705       +/-   ##
=============================================
+ Coverage     49.00%   67.39%   +18.39%     
- Complexity      257      640      +383     
=============================================
  Files          3481     3481               
  Lines        126225   126253       +28     
  Branches      14157    14153        -4     
=============================================
+ Hits          61851    85086    +23235     
+ Misses        59002    34722    -24280     
- Partials       5372     6445     +1073     
Flag Coverage Δ
integration 49.01% <82.05%> (+0.01%) ⬆️
integration-h2 34.28% <0.00%> (?)
unit 31.52% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...r/export/enrollment/EnrollmentOperationParams.java 89.28% <ø> (ø)
...dhis/tracker/export/event/DefaultEventService.java 87.50% <ø> (ø)
...his/tracker/export/event/EventOperationParams.java 95.23% <ø> (ø)
...ort/trackedentity/DefaultTrackedEntityService.java 93.52% <100.00%> (-0.03%) ⬇️
...tracker/export/event/EventRequestParamsMapper.java 95.09% <ø> (+13.36%) ⬆️
...est/src/main/java/org/hisp/dhis/test/TestBase.java 0.00% <0.00%> (ø)
...er/export/enrollment/DefaultEnrollmentService.java 91.45% <83.78%> (-1.53%) ⬇️

... and 1278 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2f1e9ee...22e50cc. Read the comment docs.

@enricocolasante enricocolasante marked this pull request as ready for review January 20, 2025 17:17
@enricocolasante enricocolasante requested a review from a team as a code owner January 20, 2025 17:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant