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] test etag propagation when changes happen on public links #37983

Merged
merged 1 commit into from
Oct 6, 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
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,31 @@ Feature: propagation of etags when deleting a file or folder
| dav_version |
| old |
| new |

Scenario: deleting a file in a publicly shared folder changes its etag for the sharer
Given the administrator has enabled DAV tech_preview
And user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt"
And user "Alice" has created a public link share with settings
| path | upload |
| permissions | change |
And user "Alice" has stored etag of element "/"
And user "Alice" has stored etag of element "/upload"
When the public deletes file "file.txt" from the last public share using the new public WebDAV API
Then these etags should have changed:
| user | path |
| Alice | / |
| Alice | /upload |

Scenario: deleting a folder in a publicly shared folder changes its etag for the sharer
Given the administrator has enabled DAV tech_preview
And user "Alice" has created folder "/upload/sub"
And user "Alice" has created a public link share with settings
| path | upload |
| permissions | change |
And user "Alice" has stored etag of element "/"
And user "Alice" has stored etag of element "/upload"
When the public deletes folder "sub" from the last public share using the new public WebDAV API
Then these etags should have changed:
| user | path |
| Alice | / |
| Alice | /upload |
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,33 @@ Feature: propagation of etags when moving files or folders
| dav_version |
| old |
| new |

Scenario: renaming a file in a publicly shared folder changes its etag for the sharer
Given the administrator has enabled DAV tech_preview
And user "Alice" has created folder "/upload"
And user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt"
And user "Alice" has created a public link share with settings
| path | upload |
| permissions | change |
And user "Alice" has stored etag of element "/"
And user "Alice" has stored etag of element "/upload"
When the public renames file "file.txt" to "renamed.txt" from the last public share using the new public WebDAV API
Then these etags should have changed:
| user | path |
| Alice | / |
| Alice | /upload |

Scenario: renaming a folder in a publicly shared folder changes its etag for the sharer
Given the administrator has enabled DAV tech_preview
And user "Alice" has created folder "/upload"
And user "Alice" has created folder "/upload/sub"
And user "Alice" has created a public link share with settings
| path | upload |
| permissions | change |
And user "Alice" has stored etag of element "/"
And user "Alice" has stored etag of element "/upload"
When the public renames folder "sub" to "renamed" from the last public share using the new public WebDAV API
Then these etags should have changed:
| user | path |
| Alice | / |
| Alice | /upload |
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,17 @@ Feature: propagation of etags when creating folders
| dav_version |
| old |
| new |

Scenario: creating a folder in a publicly shared folder changes its etag for the sharer
Given the administrator has enabled DAV tech_preview
And user "Alice" has created folder "/folder"
And user "Alice" has created a public link share with settings
| path | folder |
| permissions | create |
And user "Alice" has stored etag of element "/"
And user "Alice" has stored etag of element "/folder"
When the public creates folder "created-by-public" using the new public WebDAV API
Then these etags should have changed:
| user | path |
| Alice | / |
| Alice | /folder |
13 changes: 13 additions & 0 deletions tests/acceptance/features/apiWebdavEtagPropagation2/upload.feature
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,16 @@ Feature: propagation of etags when uploading data
| dav_version |
| old |
| new |

Scenario: uploading a file into a publicly shared folder changes its etag for the sharer
Given the administrator has enabled DAV tech_preview
And user "Alice" has created a public link share with settings
| path | upload |
| permissions | create |
And user "Alice" has stored etag of element "/"
And user "Alice" has stored etag of element "/upload"
When the public uploads file "file.txt" with content "new content" using the new public WebDAV API
Then these etags should have changed:
| user | path |
| Alice | / |
| Alice | /upload |
32 changes: 30 additions & 2 deletions tests/acceptance/features/bootstrap/PublicWebDavContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public function downloadPublicFileWithPassword($password, $publicWebDAVAPIVersio
}

/**
* @When /^the public deletes file "([^"]*)" from the last public share using the (old|new) public WebDAV API$/
* @When /^the public deletes (?:file|folder|entry) "([^"]*)" from the last public share using the (old|new) public WebDAV API$/
*
* @param string $fileName
* @param string $publicWebDAVAPIVersion
Expand Down Expand Up @@ -147,7 +147,7 @@ public function thePublicDeletesFileFromTheLastPublicShareUsingThePasswordPasswo
}

/**
* @When /^the public renames file "([^"]*)" to "([^"]*)" from the last public share using the (old|new) public WebDAV API$/
* @When /^the public renames (?:file|folder|entry) "([^"]*)" to "([^"]*)" from the last public share using the (old|new) public WebDAV API$/
*
* @param string $fileName
* @param string $toFileName
Expand Down Expand Up @@ -982,6 +982,34 @@ public function thePublicUploadsFileToLastSharedFolderWithMtimeUsingTheWebdavApi
);
}

/**
* @When the public creates folder :destination using the new public WebDAV API
*
* @param String $destination
*
* @return void
*/
public function publicCreatesFolder($destination) {
$token = $this->featureContext->getLastShareToken();
$davPath = WebDavHelper::getDavPath(
$token, 0, "public-files-new"
);
$url = $this->featureContext->getBaseUrl() . "/$davPath";
$userName = $this->getUsernameForPublicWebdavApi(
$token, '', "new"
);
$filename = \implode(
'/', \array_map('rawurlencode', \explode('/', $destination))
);
$url .= \ltrim($filename, '/');

$this->featureContext->setResponse(
HttpRequestHelper::sendRequest(
$url, 'MKCOL', $userName, ''
)
);
}

/**
* @Then the mtime of file :fileName in the last shared public link using the WebDAV API should be :mtime
*
Expand Down