Skip to content

Commit

Permalink
Merge pull request #33121 from owncloud/occTest-cliProvisioning-getGr…
Browse files Browse the repository at this point in the history
…oups

Occ test cli provisioning get groups
  • Loading branch information
phil-davis authored Oct 10, 2018
2 parents 96a3e2e + 29293db commit 438615a
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 0 deletions.
56 changes: 56 additions & 0 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,30 @@ public function theAdministratorDeletesGroupUsingTheOccCommand($group) {
);
}

/**
* @When the administrator gets the users in the group :groupName using the occ command
*
* @param string $groupName
*
* @return void
*/
public function theAdministratorGetsTheUsersInTheGroupUsingTheOccCommand($groupName) {
$this->featureContext->invokingTheCommand(
"group:list-members $groupName --output=json"
);
}

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

/**
* @When the administrator disables the app :appName using the occ command
*
Expand Down Expand Up @@ -365,6 +389,38 @@ public function theAppsReturnedByTheOccCommandShouldInclude(TableNode $appListTa
}
}

/**
* @Then the users returned by the occ command should be
*
* @param TableNode $useridTable
*
* @return void
*/
public function theUsersReturnedByTheOccCommandShouldBe(TableNode $useridTable) {
$lastOutput = $this->featureContext->getStdOutOfOccCommand();
$lastOutputUsers = \json_decode($lastOutput, true);
foreach ($useridTable as $row) {
PHPUnit_Framework_Assert::assertArrayHasKey($row['uid'], $lastOutputUsers);
PHPUnit_Framework_Assert::assertContains($row['display name'], $lastOutputUsers);
}
}

/**
* @Then the groups returned by the occ command should be
*
* @param TableNode $groupTableNode with group name with header group
*
* @return void
*/
public function theGroupsReturnedByTheOccCommandShouldBe(TableNode $groupTableNode) {
$lastOutput = $this->featureContext->getStdOutOfOccCommand();
$lastOutputGroups = \json_decode($lastOutput, true);

foreach ($groupTableNode as $row) {
PHPUnit_Framework_Assert::assertContains($row['group'], $lastOutputGroups);
}
}

/**
* This will run before EVERY scenario.
* It will set the properties for this object.
Expand Down
31 changes: 31 additions & 0 deletions tests/acceptance/features/cliProvisioning/getGroup.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@cli @skipOnLDAP
Feature: get group
As an admin
I want to be able to get group details
So that I can know which users are in a group

Scenario: admin gets users in the group
Given user "brand-new-user" has been created
And user "%admin%" has changed the display name of user "brand-new-user" to "Anne Brown"
And user "123" has been created
And group "new-group" has been created
And user "brand-new-user" has been added to group "new-group"
And user "123" has been added to group "new-group"
When the administrator gets the users in the group "new-group" using the occ command
Then the command should have been successful
And the users returned by the occ command should be
| uid | display name |
| brand-new-user | Anne Brown |
| 123 | 123 |

Scenario: admin gets user in the group who is disabled
Given user "brand-new-user" has been created
And user "%admin%" has changed the display name of user "brand-new-user" to "Anne Brown"
And user "brand-new-user" has been disabled
And group "new-group" has been created
And user "brand-new-user" has been added to group "new-group"
When the administrator gets the users in the group "new-group" using the occ command
Then the command should have been successful
And the users returned by the occ command should be
| uid | display name |
| brand-new-user | Anne Brown |
18 changes: 18 additions & 0 deletions tests/acceptance/features/cliProvisioning/getGroups.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@cli @skipOnLDAP
Feature: get groups
As an admin
I want to be able to get groups
So that I can see all the groups in my ownCloud

Scenario: admin gets all the groups
Given group "0" has been created
And group "new-group" has been created
And group "España" has been created
When the administrator gets the groups using the occ command
Then the command should have been successful
And the groups returned by the occ command should be
| group |
| España |
| admin |
| new-group |
| 0 |

0 comments on commit 438615a

Please sign in to comment.