Skip to content

Commit

Permalink
Added failing testcase for issue 1563 .
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Whiting committed Apr 2, 2024
1 parent 7dea250 commit c5cbb87
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,4 +425,23 @@ private void assertUserSearch(String search, String... expected) {
assertThrows(ForbiddenException.class, () -> userService.updateAdministrators(null));
});
}

@TestSecurity(user = KEYCLOAK_ADMIN, roles = { Roles.ADMIN })
@Test void userCountAfterDeleteTeamTest() {
int beforeCount = userService.searchUsers("").size();
String testTeam = "funky-test-team", otherTeam = "some-team-that-does-not-exist-team";
userService.addTeam(testTeam);
String testUserName = "funky-team-user";

// create a test user
UserService.NewUser testUser = new UserService.NewUser();
testUser.user = new UserService.UserData("", testUserName, "Fun", "Key", "[email protected]");
testUser.password = "secret";
testUser.team = testTeam;
testUser.roles = Collections.emptyList();
userService.createUser(testUser);
assertEquals(beforeCount + 1, userService.searchUsers("").size());
userService.deleteTeam (testTeam);
assertEquals(beforeCount, userService.searchUsers("").size());
}
}

0 comments on commit c5cbb87

Please sign in to comment.