Skip to content

Commit

Permalink
Add tests for userReport
Browse files Browse the repository at this point in the history
  • Loading branch information
paurakhsharma committed Oct 23, 2018
1 parent 3d854b1 commit 4f5d961
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ public function theAdministratorRetrievesTheTimeWhenUserWasLastSeenUsingTheOccCo
);
}

/**
* @When the administrator retrieves the user report using the occ command
*
* @return void
*/
public function theAdministratorRetrievesTheUserReportUsingTheOccCommand() {
$this->featureContext->invokingTheCommand("user:report");
}

/**
* @When the administrator sends a group creation request for group :group using the occ command
*
Expand Down Expand Up @@ -544,6 +553,19 @@ public function theCommandOutputOfUserLastSeenShouldBeNever() {
);
}

/**
* @Then the total users returned by the commmand should be :noOfUsers
*
* @param integer $noOfUsers
*
* @return void
*/
public function theTotalUsersReturnedByTheCommmandShouldBe($noOfUsers) {
$lastOutput = $this->featureContext->getStdOutOfOccCommand();
\preg_match("/\|\s+total users\s+\|\s+(\d+)\s+\|/", $lastOutput, $actualUsers);
PHPUnit_Framework_Assert::assertEquals($noOfUsers, $actualUsers[1]);
}

/**
* @When the administrator sets the log level to :level using the occ command
*
Expand Down
34 changes: 34 additions & 0 deletions tests/acceptance/features/cliProvisioning/userReport.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@cli @skipOnLDAP
Feature: get user report
As an admin
I want to be able get user report
So that I can see the total number of users in an ownCloud server

Scenario: admin gets the user report
Given these users have been created but not initialized:
| username |
| brand-new-user-1 |
| brand-new-user-2 |
When the administrator retrieves the user report using the occ command
Then the command should have been successful
And the total users returned by the commmand should be 3

Scenario: admin gets the user report when the user is disabled
Given these users have been created but not initialized:
| username |
| brand-new-user-1 |
| brand-new-user-2 |
And user "brand-new-user-2" has been disabled
When the administrator retrieves the user report using the occ command
Then the command should have been successful
And the total users returned by the commmand should be 3

Scenario: admin gets the user report when the user created and deleted
Given these users have been created but not initialized:
| username |
| brand-new-user-1 |
| brand-new-user-2 |
And user "brand-new-user-2" has been deleted
When the administrator retrieves the user report using the occ command
Then the command should have been successful
And the total users returned by the commmand should be 2

0 comments on commit 4f5d961

Please sign in to comment.