Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests-only] Adds API tests to check the file deletion time #38239

Merged
merged 2 commits into from
Dec 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions tests/acceptance/features/apiTrashbin/trashbinFilesFolders.feature
Original file line number Diff line number Diff line change
Expand Up @@ -271,3 +271,15 @@ Feature: files and folders exist in the trashbin after being deleted
| dav-path |
| old |
| new |

Scenario Outline: deleted file has appropriate deletion time information
Given using <dav-path> DAV path
And user "Alice" has deleted file "textfile0.txt"
When user "Alice" tries to list the trashbin content for user "Alice"
Then the last webdav response should contain the following elements
| path | mtime |
| /textfile0.txt | deleted_mtime |
Examples:
| dav-path |
| old |
| new |
22 changes: 17 additions & 5 deletions tests/acceptance/features/bootstrap/TrashbinContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,13 +260,25 @@ public function theLastWebdavResponseShouldContainFollowingElements(TableNode $e
foreach ($elementRows as $expectedElement) {
$found = false;
$expectedPath = $expectedElement['path'];
foreach ($files as $file) {
if (\ltrim($expectedPath, "/") === \ltrim($file['original-location'], "/")) {
$found = true;
break;
$expectedMtime = $expectedElement['mtime'] === "deleted_mtime" ? $this->featureContext->getLastUploadDeleteTime() : $expectedElement['mtime'];

if (isset($expectedElement['mtime'])) {
foreach ($files as $file) {
if (\ltrim($expectedPath, "/") === \ltrim($file['original-location'], "/") && \ltrim($expectedMtime, "/") === \ltrim($file['mtime'], "/")) {
$found = true;
break;
}
}
Assert::assertTrue($found, "$expectedPath with mtime $expectedMtime expected to be listed in response but not found");
} else {
foreach ($files as $file) {
if (\ltrim($expectedPath, "/") === \ltrim($file['original-location'], "/")) {
$found = true;
break;
}
}
Assert::assertTrue($found, "$expectedPath expected to be listed in response but not found");
}
Assert::assertTrue($found, "$expectedPath expected to be listed in response but not found");
}
}

Expand Down
7 changes: 7 additions & 0 deletions tests/acceptance/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ public function setLastUploadDeleteTime($lastUploadDeleteTime) {
$this->lastUploadDeleteTime = $lastUploadDeleteTime;
}

/**
* @return number
*/
public function getLastUploadDeleteTime() {
return $this->lastUploadDeleteTime;
}

/**
* @return SimpleXMLElement
*/
Expand Down