Skip to content

Commit

Permalink
Merge pull request #33534 from owncloud/cli-Test-Trashbin
Browse files Browse the repository at this point in the history
cli Test trashbin
  • Loading branch information
phil-davis authored Nov 16, 2018
2 parents 75cad4a + c883aca commit fb606bb
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -883,6 +883,16 @@ matrix:
CHOWN_SERVER: true
OWNCLOUD_LOG: true

# CLI Trashbin Acceptance tests
- PHP_VERSION: 7.1
TEST_SUITE: cli
BEHAT_SUITE: cliTrashbin
DB_TYPE: mariadb
USE_SERVER: true
INSTALL_SERVER: true
CHOWN_SERVER: true
OWNCLOUD_LOG: true

# UI Acceptance tests
- PHP_VERSION: 7.1
TEST_SUITE: selenium
Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/config/behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ default:
- FeatureContext: *common_feature_context_params
- OccContext:

cliTrashbin:
paths:
- %paths.base%/../features/cliTrashbin
contexts:
- FeatureContext: *common_feature_context_params
- OccContext:

webUIAdminSettings:
paths:
- %paths.base%/../features/webUIAdminSettings
Expand Down
22 changes: 22 additions & 0 deletions tests/acceptance/features/bootstrap/OccContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,28 @@ public function theAdministratorDeletesSystemConfigKeyUsingTheOccCommand($key) {
);
}

/**
* @When the administrator empties the trashbin of user :user using the occ command
*
* @param string $user
*
* @return void
*/
public function theAdministratorEmptiesTheTrashbinOfUserUsingTheOccCommand($user) {
$this->featureContext->invokingTheCommand(
"trashbin:cleanup $user"
);
}

/**
* @When the administrator empties the trashbin of all users using the occ command
*
* @return void
*/
public function theAdministratorEmptiesTheTrashbinOfAllUsersUsingTheOccCommand() {
$this->theAdministratorEmptiesTheTrashbinOfUserUsingTheOccCommand('');
}

/**
* @Then system config key :key should have value :value
*
Expand Down
30 changes: 30 additions & 0 deletions tests/acceptance/features/cliTrashbin/trashbin.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@cli @TestAlsoOnExternalUserBackend @files_trashbin-app-required
Feature: files and folders can be deleted from the trashbin
As an admin
I want to delete files and folders from the trashbin
So that I can control user trashbin space and which files are kept in that space

Scenario: delete files and folder of a user from the trashbin
Given user "user0" has been created
And user "user0" has deleted file "/textfile0.txt"
And user "user0" has deleted file "/textfile1.txt"
And user "user0" has deleted folder "/PARENT"
When the administrator empties the trashbin of user "user0" using the occ command
Then the command should have been successful
And the command output should contain the text 'Remove deleted files of user0'
Then as "user0" the file with original path "/textfile0.txt" should not exist in trash
And as "user0" the file with original path "/textfile1.txt" should not exist in trash
And as "user0" the folder with original path "/PARENT" should not exist in trash

Scenario: delete files and folder of all user from the trashbin
Given user "user0" has been created
And user "user1" has been created
And user "user0" has deleted file "/textfile0.txt"
And user "user1" has deleted file "/textfile1.txt"
And user "user1" has deleted folder "/PARENT"
When the administrator empties the trashbin of all users using the occ command
Then the command should have been successful
And the command output should contain the text "Remove all deleted files"
Then as "user0" the file with original path "/textfile0.txt" should not exist in trash
And as "user1" the file with original path "/textfile1.txt" should not exist in trash
And as "user1" the folder with original path "/PARENT" should not exist in trash

0 comments on commit fb606bb

Please sign in to comment.