mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 23:12:06 -03:30
[KEYCLOAK-6376] Directly create group
This commit is contained in:
parent
21a62a2670
commit
5ad05c9317
@ -372,19 +372,15 @@ public class CustomAuthFlowOTPTest extends AbstractCustomAccountManagementTest {
|
||||
}
|
||||
|
||||
private GroupRepresentation getOrCreateOTPRoleInGroup() {
|
||||
try {
|
||||
return testRealmResource().groups().groups("otp_group",0,1).get(0);
|
||||
} catch (NotFoundException | IndexOutOfBoundsException ex ) {
|
||||
GroupRepresentation group = new GroupRepresentation();
|
||||
group.setName("otp_group");
|
||||
RoleRepresentation role = getOrCreateOTPRole();
|
||||
testRealmResource().groups().add(group);
|
||||
//obtain id
|
||||
GroupRepresentation groupRep = testRealmResource().groups().groups("otp_group",0,1).get(0);
|
||||
testRealmResource().groups().group(groupRep.getId()).roles().realmLevel().add(Arrays.asList(role));
|
||||
//reread
|
||||
return testRealmResource().groups().groups("otp_group",0,1).get(0);
|
||||
}
|
||||
GroupRepresentation group = new GroupRepresentation();
|
||||
group.setName("otp_group");
|
||||
RoleRepresentation role = getOrCreateOTPRole();
|
||||
testRealmResource().groups().add(group);
|
||||
// obtain id
|
||||
GroupRepresentation groupRep = testRealmResource().groups().groups("otp_group",0,1).get(0);
|
||||
testRealmResource().groups().group(groupRep.getId()).roles().realmLevel().add(Arrays.asList(role));
|
||||
// reread
|
||||
return testRealmResource().groups().groups("otp_group",0,1).get(0);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user