Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for removeFromGroup #33147

Merged
merged 1 commit into from
Oct 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,20 @@ public function theAdministratorGetsTheGroupsUsingTheOccCommand() {
);
}

/**
* @When the administrator removes user :username from group :group using the occ command
*
* @param string $username
* @param string $group
*
* @return void
*/
public function theAdministratorRemovesUserFromGroupUsingTheOccCommand($username, $group) {
$this->featureContext->invokingTheCommand(
"group:remove-member -m $username $group"
);
}

/**
* @When the administrator disables the app :appName using the occ command
*
Expand Down
40 changes: 40 additions & 0 deletions tests/acceptance/features/cliProvisioning/removeFromGroup.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
@cli @skipOnLDAP
Feature: remove a user from a group
As an admin
I want to be able to remove a user from a group
So that I can manage user access to group resources

Scenario Outline: admin removes a user from a group
Given user "brand-new-user" has been created
And group "<group_id>" has been created
And user "brand-new-user" has been added to group "<group_id>"
When the administrator removes user "brand-new-user" from group "<group_id>" using the occ command
Then the command should have been successful
And the command output should contain the text 'Member "brand-new-user" removed from group "<group_id>"'
And user "brand-new-user" should not belong to group "<group_id>"
Examples:
| group_id | comment |
| simplegroup | nothing special here |
| España | special European characters |
| नेपाली | Unicode group name |

Scenario: admin tries to remove a user from a group which does not exist
Given user "brand-new-user" has been created
And group "not-group" has been deleted
When the administrator removes user "brand-new-user" from group "not-group" using the occ command
Then the command should have failed with exit code 1
And the command output should contain the text 'Group "not-group" does not exist'

Scenario: admin tries to remove a user from a group which he is not member of
Given user "brand-new-user" has been created
And group "new-group" has been created
When the administrator removes user "brand-new-user" from group "new-group" using the occ command
Then the command should have been successful
And the command output should contain the text 'Member "brand-new-user" could not be found in group "new-group"'

Scenario: admin tries to remove a user who does not exists from an existing group
Given user "not-a-user" has been deleted
And group "new-group" has been created
When the administrator removes user "not-a-user" from group "new-group" using the occ command
Then the command should have failed with exit code 1
And the command output should contain the text 'Member "not-a-user" does not exist - not removed from group "new-group"'