Skip to content

Commit

Permalink
users/roles unit tests fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ekazachkova committed Dec 13, 2024
1 parent d456438 commit c2a3c5b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public void shouldAssignRoleForAdmin() {
@Test
@WithMockUser
public void shouldDenyAssignRoleForNotAdmin() {
initAclEntity(UserCreatorUtils.getRole(extendedRole.getName(), extendedRole.getId(), ANOTHER_SIMPLE_USER));
doReturn(extendedRole).when(mockRoleManager).assignRole(ID, TEST_LONG_LIST);

assertThrows(AccessDeniedException.class, () -> roleApiService.assignRole(ID, TEST_LONG_LIST));
Expand All @@ -206,6 +207,7 @@ public void shouldRemoveRoleForAdmin() {
@Test
@WithMockUser
public void shouldDenyRemoveRoleForNotAdmin() {
initAclEntity(UserCreatorUtils.getRole(extendedRole.getName(), extendedRole.getId(), ANOTHER_SIMPLE_USER));
doReturn(extendedRole).when(mockRoleManager).removeRole(ID, TEST_LONG_LIST);

assertThrows(AccessDeniedException.class, () -> roleApiService.removeRole(ID, TEST_LONG_LIST));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
@Transactional
public class RoleDaoTest extends AbstractJdbcTest {

private static final int EXPECTED_DEFAULT_ROLES_NUMBER = 21;
private static final int EXPECTED_DEFAULT_ROLES_NUMBER = 22;
private static final String TEST_USER1 = "test_user1";
private static final String TEST_ROLE = "ROLE_TEST";
private static final String TEST_ROLE_UPDATED = "NEW_ROLE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class UserDaoTest extends AbstractJdbcTest {
private static final String ATTRIBUTES_KEY = "email";
private static final String ATTRIBUTES_VALUE = "test_email";
private static final String ATTRIBUTES_VALUE2 = "Mail@epam.com";
private static final int EXPECTED_DEFAULT_ROLES_NUMBER = 21;
private static final int EXPECTED_DEFAULT_ROLES_NUMBER = 22;
private static final String TEST_ROLE = "ROLE_TEST";

@Autowired
Expand Down

0 comments on commit c2a3c5b

Please sign in to comment.