Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cgendreau committed Feb 14, 2025
1 parent 3d3c207 commit 4c8e322
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ public final class KeycloakClaimParser {
private KeycloakClaimParser() {
}

/**
* Parses a set of roles from Keycloak.
* If the role is admin-based, it is added to adminRoles. Otherwise, the role is ignored.
* @param roles
* @return
*/
public static Set<DinaRole> parseAdminRoles(Set<String> roles) {
if (CollectionUtils.isEmpty(roles)) {
return Collections.emptySet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public void create_WhenNotAdmin_AccessDenied() {
}

@Test
@WithMockKeycloakUser(groupRole = {"CNC:DINA_ADMIN"})
@WithMockKeycloakUser(adminRole = {"DINA_ADMIN"})
void update_WhenAdmin_AccessAccepted() {
assertDoesNotThrow(() -> testRepo.save(ItemDto.builder().uuid(persisted.getUuid()).build()));
}
Expand All @@ -95,7 +95,7 @@ public void update_WhenNotAdmin_AccessDenied() {
}

@Test
@WithMockKeycloakUser(groupRole = {"CNC:DINA_ADMIN"})
@WithMockKeycloakUser(adminRole = {"DINA_ADMIN"})
public void delete_WhenAdmin_AccessAccepted() {
assertDoesNotThrow(() -> testRepo.delete(persisted.getUuid()));
}
Expand Down

0 comments on commit 4c8e322

Please sign in to comment.