Skip to content

Commit

Permalink
Add tests for getUserGroups
Browse files Browse the repository at this point in the history
  • Loading branch information
paurakhsharma committed Oct 10, 2018
1 parent 9159b45 commit 083e2a7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/acceptance/features/bootstrap/CommandLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,11 +468,11 @@ public function theCommandErrorOutputContainsTheText($text) {
}

/**
* @Then the occ command output should be empty
* @Then the occ command JSON output should be empty
*
* @return void
*/
public function theOccCommandOutputShouldNotReturnAnyData() {
public function theOccCommandJsonOutputShouldNotReturnAnyData() {
PHPUnit_Framework_Assert::assertEquals(\trim($this->lastStdOut), "[]");
PHPUnit_Framework_Assert::assertEmpty($this->lastStdErr);
}
Expand Down
13 changes: 13 additions & 0 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@ public function theAdministratorRetrievesTheInformationOfUserUsingTheOccCommand(
);
}

/**
* @When the administrator gets the groups of user :username using the occ command
*
* @param string $username
*
* @return void
*/
public function theAdministratorGetsTheGroupsOfUserUsingTheOccCommand($username) {
$this->featureContext->invokingTheCommand(
"user:list-group $username --output=json"
);
}

/**
* @When the administrator sends a group creation request for group :group using the occ command
*
Expand Down
36 changes: 36 additions & 0 deletions tests/acceptance/features/cliProvisioning/getUserGroups.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
@cli @skipOnLDAP
Feature: get user groups
As an admin
I want to be able to get groups
So that I can manage group membership

Scenario: admin gets groups of an user
Given user "brand-new-user" has been created
And group "unused-group" has been created
And group "new-group" has been created
And group "0" has been created
And group "Admin & Finance (NP)" has been created
And group "admin:Pokhara@Nepal" has been created
And group "नेपाली" has been created
And user "brand-new-user" has been added to group "new-group"
And user "brand-new-user" has been added to group "0"
And user "brand-new-user" has been added to group "Admin & Finance (NP)"
And user "brand-new-user" has been added to group "admin:Pokhara@Nepal"
And user "brand-new-user" has been added to group "नेपाली"
When the administrator gets the groups of user "brand-new-user" using the occ command
Then the command should have been successful
And the groups returned by the occ command should be
| group |
| new-group |
| 0 |
| Admin & Finance (NP) |
| admin:Pokhara@Nepal |
| नेपाली |

Scenario: admin gets groups of an user who is not in any groups
Given user "brand-new-user" has been created
And group "unused-group" has been created
When the administrator gets the groups of user "brand-new-user" using the occ command
Then the command should have been successful
And the list of groups returned by the API should be empty
And the occ command JSON output should be empty

0 comments on commit 083e2a7

Please sign in to comment.