use of com.enonic.xp.security.UpdateRoleParams in project xp by enonic.
the class SecurityServiceImplTest method testUpdateRole.
@Test
public void testUpdateRole() throws Exception {
runAsAdmin(() -> {
final CreateRoleParams createRole = CreateRoleParams.create().roleKey(PrincipalKey.ofRole("Role-a")).displayName("Role A").build();
final Role role = securityService.createRole(createRole);
final UpdateRoleParams roleUpdate = UpdateRoleParams.create(role).displayName("___Role B___").description("description").build();
final Role updatedRoleResult = securityService.updateRole(roleUpdate);
refresh();
final Role updatedRole = securityService.getRole(role.getKey()).get();
assertEquals("___Role B___", updatedRoleResult.getDisplayName());
assertEquals("___Role B___", updatedRole.getDisplayName());
assertEquals("description", updatedRoleResult.getDescription());
assertEquals("description", updatedRole.getDescription());
});
}
Aggregations