diff options
Diffstat (limited to 'sonar-db')
-rw-r--r-- | sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java | 8 | ||||
-rw-r--r-- | sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java | 10 |
2 files changed, 17 insertions, 1 deletions
diff --git a/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java b/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java index 344d5dcb7ce..af7abd8f7c7 100644 --- a/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java +++ b/sonar-db/src/test/java/org/sonar/db/user/RootFlagAssertions.java @@ -51,6 +51,12 @@ public class RootFlagAssertions { .isEqualTo(root); assertThat(dto.getUpdatedAt()) .as("UpdatedAt of user '%s' has changed since insertion", userDto.getLogin()) - .isNotEqualTo(userDto); + .isNotEqualTo(userDto.getUpdatedAt()); + } + + public void verify(String login, boolean root) { + assertThat(db.getDbClient().userDao().selectByLogin(db.getSession(), login).isRoot()) + .as("Root flag of user '%s' is '%s'", login, root) + .isEqualTo(root); } } diff --git a/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java b/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java index 31ef077d935..3f8e9f63dfb 100644 --- a/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java +++ b/sonar-db/src/test/java/org/sonar/db/user/UserDbTester.java @@ -173,6 +173,16 @@ public class UserDbTester { } /** + * Creates a group with the specified name in the specified organization with {@link GlobalPermissions#SYSTEM_ADMIN} + * permission. + */ + public GroupDto insertAdminGroup(OrganizationDto organizationDto, String name) { + GroupDto groupDto = insertGroup(organizationDto, name); + insertPermissionOnGroup(groupDto, SYSTEM_ADMIN); + return groupDto; + } + + /** * Create group in specified organization */ public GroupDto insertGroup(OrganizationDto organizationDto) { |