Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
  • Loading branch information
wangxj959 committed Sep 26, 2024
1 parent c99203a commit 19d9cce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,7 @@ public boolean permissionCheck(int userId, String url, Logger logger) {
logger.error("User does not exist, userId:{}.", userId);
return false;
}
if (user.getUserType() != UserType.ADMIN_USER) {
return false;
}
return true;
return user.getUserType() == UserType.ADMIN_USER;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ public void testPermissionCheck() {
when(userDao.queryById(user.getId())).thenReturn(user);
Assertions.assertTrue(environmentResourcePermissionCheck.permissionCheck(user.getId(), null, logger));
}
@Test
public void testPermissionCheckFail() {
User user = getLoginAdminUser();
when(userDao.queryById(user.getId())).thenReturn(null);
Assertions.assertFalse(environmentResourcePermissionCheck.permissionCheck(user.getId(), null, logger));
}

@Test
public void testAuthorizationTypes() {
Expand Down

0 comments on commit 19d9cce

Please sign in to comment.