Skip to content

Commit 880b572

Browse files
authored
Merge pull request #11353 from owncloud/purge-expired-trashed-resource
[tests-only][full-ci] Add tests related to purge expired trash resources
2 parents 621b09d + c262bbd commit 880b572

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

tests/acceptance/bootstrap/CliContext.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,4 +894,17 @@ public function theAdministratorRestoresTheTrashedResourcesOfSpaceOwnedByUser(
894894
];
895895
$this->featureContext->setResponse(CliHelper::runCommand($body));
896896
}
897+
898+
/**
899+
* @When the administrator purges the expired trash resources
900+
*
901+
* @return void
902+
* @throws GuzzleException
903+
*/
904+
public function theAdministratorPurgesTheExpiredTrashResources(): void {
905+
$body = [
906+
"command" => "storage-users trash-bin purge-expired"
907+
];
908+
$this->featureContext->setResponse(CliHelper::runCommand($body));
909+
}
897910
}

tests/acceptance/features/cliCommands/trashBin.feature

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,47 @@ Feature: trashbin
9292
| resource | type |
9393
| /testfile.txt | file |
9494
| /folder-to-delete | folder |
95+
96+
97+
Scenario: purge expired trashed resources of Personal space
98+
Given the following configs have been set:
99+
| config | value |
100+
| STORAGE_USERS_PURGE_TRASH_BIN_PERSONAL_DELETE_BEFORE | 1s |
101+
And using spaces DAV path
102+
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
103+
And user "Alice" has created the following folders
104+
| path |
105+
| folder-to-delete |
106+
And user "Alice" has deleted folder "/folder-to-delete"
107+
And user "Alice" has created a space "Newspace" with the default quota using the Graph API
108+
And user "Alice" has created a folder "uploadFolder" in space "Newspace"
109+
And user "Alice" has uploaded a file inside space "Newspace" with content "hello world" to "text.txt"
110+
And user "Alice" has removed the file "text.txt" from space "Newspace"
111+
And the system waits for "1" seconds
112+
When the administrator purges the expired trash resources
113+
Then there should be no trashed resources of space "Personal" owned by user "Alice"
114+
And there should be "1" trashed resources of space "Newspace" owned by user "Alice":
115+
| resource | type |
116+
| /text.txt | file |
117+
118+
119+
Scenario: purge expired trashed resources of project space
120+
Given the following configs have been set:
121+
| config | value |
122+
| STORAGE_USERS_PURGE_TRASH_BIN_PROJECT_DELETE_BEFORE | 1s |
123+
And using spaces DAV path
124+
And the administrator has assigned the role "Space Admin" to user "Alice" using the Graph API
125+
And user "Alice" has created the following folders
126+
| path |
127+
| folder-to-delete |
128+
And user "Alice" has deleted folder "/folder-to-delete"
129+
And user "Alice" has created a space "Newspace" with the default quota using the Graph API
130+
And user "Alice" has created a folder "uploadFolder" in space "Newspace"
131+
And user "Alice" has uploaded a file inside space "Newspace" with content "hello world" to "text.txt"
132+
And user "Alice" has removed the file "text.txt" from space "Newspace"
133+
And the system waits for "1" seconds
134+
When the administrator purges the expired trash resources
135+
Then there should be no trashed resources of space "Newspace" owned by user "Alice"
136+
And there should be "1" trashed resources of space "Personal" owned by user "Alice":
137+
| resource | type |
138+
| /folder-to-delete | folder |

0 commit comments

Comments
 (0)