Skip to content

Commit

Permalink
Clean up tests
Browse files Browse the repository at this point in the history
  • Loading branch information
enricocolasante committed Jan 20, 2025
1 parent 6fdab74 commit 55e30d6
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class EnrollmentServiceTest extends PostgresIntegrationTestBase {

private User admin;

private User userWithoutOrgUnit;
private User userWithOrgUnitZ;

private User authorizedUser;

Expand Down Expand Up @@ -146,8 +146,8 @@ void setUp() {
User user =
createAndAddUser(false, "user", Set.of(orgUnitA), Set.of(orgUnitA), "F_EXPORT_DATA");
user.setTeiSearchOrganisationUnits(Set.of(orgUnitA, orgUnitB, orgUnitC));
userWithoutOrgUnit = createUserWithAuth("userWithoutOrgUnit");
userWithoutOrgUnit.setTeiSearchOrganisationUnits(Set.of(orgUnitZ));
userWithOrgUnitZ = createUserWithAuth("userWithoutOrgUnit");
userWithOrgUnitZ.setTeiSearchOrganisationUnits(Set.of(orgUnitZ));
authorizedUser =
createAndAddUser(
false,
Expand Down Expand Up @@ -407,7 +407,7 @@ void shouldFailGettingEnrollmentWhenUserHasReadAccessToProgramButNoAccessToOrgUn
programA.getSharing().setPublicAccess(AccessStringHelper.DATA_READ);
manager.updateNoAcl(programA);

injectSecurityContextUser(userWithoutOrgUnit);
injectSecurityContextUser(userWithOrgUnitZ);

NotFoundException exception =
assertThrows(
Expand All @@ -423,7 +423,7 @@ void shouldFailGettingEnrollmentWhenUserHasReadWriteAccessToProgramButNoAccessTo
programA.getSharing().setPublicAccess(AccessStringHelper.DATA_READ_WRITE);
manager.updateNoAcl(programA);

injectSecurityContextUser(userWithoutOrgUnit);
injectSecurityContextUser(userWithOrgUnitZ);

NotFoundException exception =
assertThrows(
Expand Down Expand Up @@ -682,7 +682,7 @@ void shouldFailWhenOrgUnitModeAllAndUserNotAuthorized() {

@Test
void shouldFailWhenUserCanSearchEverywhereModeDescendantsAndOrgUnitNotInSearchScope() {
injectSecurityContextUser(userWithoutOrgUnit);
injectSecurityContextUser(userWithOrgUnitZ);

EnrollmentOperationParams operationParams =
EnrollmentOperationParams.builder().orgUnitMode(DESCENDANTS).orgUnits(orgUnitA).build();
Expand Down Expand Up @@ -762,7 +762,7 @@ void shouldReturnChildrenOfRequestedOrgUnitWhenOrgUnitModeChildren()
}

@Test
void shouldFailWhenRequestingListOfEnrollmentsAndAtLeastOneNotAccessible()
void shouldReturnEmptyListFailWhenRequestingEnrollmentsAndTheyAreNotAccessible()
throws ForbiddenException {
injectSecurityContextUser(admin);
programA.getSharing().setPublicAccess("rw------");
Expand Down

0 comments on commit 55e30d6

Please sign in to comment.