const newGroup = {
profile: {
name: 'Group-Member API Test Group'
}
};
Create a group rule and verify rule executes → POST /api/v1/groups/rules
The rule below adds the user created in step 1 to the group created in step 2 upon rule execution/activation
Activate the above rule and verify that user is added to the group → POST /api/v1/groups/rules/{{ruleId}}/lifecycle/activate
I have noted that there is a slight delay between the rule activation and triggering the rule action.
Hence wait for 1-2 seconds before validating the rule execution, in this case, validating that user was added to the group.
List the group rules and validate the above rule is present → POST /api/v1/groups/rules
Deactivate the rule and update it (Rule can only be updated when it's deactivated) → POST /api/v1/groups/rules/{{ruleId}}/lifecycle/deactivate + POST /api/v1/groups/rules/{{ruleId}}
rule.name = 'Test group rule updated';
rule.conditions.expression.value = 'user.lastName==\"incorrect\"';
Activate the updated rule and verify that the user is removed from the group → POST /api/v1/groups/rules/{{ruleId}}/lifecycle/activate
Delete the user, group and group rule → POST /api/v1/users/{{userId}}/lifecycle/deactivate + DELETE /api/v1/users/{{userId}} + DELETE /api/v1/groups/{{groupId}} + DELETE /api/v1/groups/rules/{{ruleId}}