mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-30 15:59:55 -05:00
tests: add test for lock/unlock in public link share (#7789)
This commit is contained in:
committed by
GitHub
parent
334684f2b6
commit
a1dd520262
@@ -368,6 +368,29 @@ Feature: lock files
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
@issue-7641
|
||||
Scenario Outline: try to lock a folder as anonymous user
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has created folder "PARENT"
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/textfile0.txt"
|
||||
And user "Alice" has created a public link share with settings
|
||||
| path | PARENT |
|
||||
| permissions | change |
|
||||
| password | %public% |
|
||||
When the public locks the last public link shared file using the WebDAV API setting the following properties
|
||||
| lockscope | <lock-scope> |
|
||||
Then the HTTP status code should be "403"
|
||||
And 0 locks should be reported for file "PARENT" of user "Alice" by the WebDAV API
|
||||
And user "Alice" should be able to upload file "filesForUpload/lorem.txt" to "PARENT/textfile0.txt"
|
||||
And user "Alice" should be able to create folder "/PARENT/sub-folder"
|
||||
Examples:
|
||||
| dav-path-version | lock-scope |
|
||||
| old | shared |
|
||||
| old | exclusive |
|
||||
| new | shared |
|
||||
| new | exclusive |
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
Scenario Outline: lock expiration
|
||||
Given using <dav-path-version> DAV path
|
||||
@@ -386,3 +409,93 @@ Feature: lock files
|
||||
| new | exclusive |
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
|
||||
Scenario Outline: lock a file inside a folder shared by a link as anonymous user with edit permission
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has created folder "PARENT"
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/textfile0.txt"
|
||||
And user "Alice" has created a public link share with settings
|
||||
| path | PARENT |
|
||||
| permissions | change |
|
||||
| password | %public% |
|
||||
When the public locks "textfile0.txt" in the last public link shared folder using the new public WebDAV API setting the following properties
|
||||
| lockscope | <lock-scope> |
|
||||
Then the HTTP status code should be "200"
|
||||
And 1 locks should be reported for file "PARENT/textfile0.txt" of user "Alice" by the WebDAV API
|
||||
And user "Alice" should not be able to upload file "filesForUpload/lorem.txt" to "PARENT/textfile0.txt"
|
||||
Examples:
|
||||
| dav-path-version | lock-scope |
|
||||
| old | shared |
|
||||
| old | exclusive |
|
||||
| new | shared |
|
||||
| new | exclusive |
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
|
||||
Scenario Outline: try to lock a file inside a folder shared by a link as anonymous user with read permission
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has created folder "PARENT"
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/textfile0.txt"
|
||||
And user "Alice" has created a public link share with settings
|
||||
| path | PARENT |
|
||||
| permissions | read |
|
||||
| password | %public% |
|
||||
When the public tries to lock "textfile0.txt" in the last public link shared folder using the new public WebDAV API setting the following properties
|
||||
| lockscope | <lock-scope> |
|
||||
Then the HTTP status code should be "403"
|
||||
And 0 locks should be reported for file "PARENT/textfile0.txt" of user "Alice" by the WebDAV API
|
||||
And user "Alice" should be able to upload file "filesForUpload/lorem.txt" to "PARENT/textfile0.txt"
|
||||
Examples:
|
||||
| dav-path-version | lock-scope |
|
||||
| old | shared |
|
||||
| old | exclusive |
|
||||
| new | shared |
|
||||
| new | exclusive |
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
|
||||
Scenario Outline: lock a file shared by a link as anonymous user with edit permission
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile0.txt"
|
||||
And user "Alice" has created a public link share with settings
|
||||
| path | textfile0.txt |
|
||||
| permissions | change |
|
||||
| password | %public% |
|
||||
When the public locks the last public link shared file using the WebDAV API setting the following properties
|
||||
| lockscope | <lock-scope> |
|
||||
Then the HTTP status code should be "200"
|
||||
And 1 locks should be reported for file "textfile0.txt" of user "Alice" by the WebDAV API
|
||||
And user "Alice" should not be able to upload file "filesForUpload/lorem.txt" to "textfile0.txt"
|
||||
Examples:
|
||||
| dav-path-version | lock-scope |
|
||||
| old | shared |
|
||||
| old | exclusive |
|
||||
| new | shared |
|
||||
| new | exclusive |
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
|
||||
Scenario Outline: try to lock a file shared by a link as anonymous user with read permission
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "textfile0.txt"
|
||||
And user "Alice" has created a public link share with settings
|
||||
| path | textfile0.txt |
|
||||
| permissions | read |
|
||||
| password | %public% |
|
||||
When the public tries to lock the last public link shared file using the WebDAV API setting the following properties
|
||||
| lockscope | <lock-scope> |
|
||||
Then the HTTP status code should be "403"
|
||||
And 0 locks should be reported for file "textfile0.txt" of user "Alice" by the WebDAV API
|
||||
And user "Alice" should be able to upload file "filesForUpload/lorem.txt" to "textfile0.txt"
|
||||
Examples:
|
||||
| dav-path-version | lock-scope |
|
||||
| old | shared |
|
||||
| old | exclusive |
|
||||
| new | shared |
|
||||
| new | exclusive |
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
@@ -274,3 +274,27 @@ Feature: unlock locked items
|
||||
| dav-path |
|
||||
| /remote.php/dav/spaces/<<FILEID>> |
|
||||
| /dav/spaces/<<FILEID>> |
|
||||
|
||||
|
||||
Scenario Outline: unlock a file as an anonymous user
|
||||
Given using <dav-path-version> DAV path
|
||||
And user "Alice" has created folder "PARENT"
|
||||
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/textfile0.txt"
|
||||
And user "Alice" has created a public link share with settings
|
||||
| path | PARENT |
|
||||
| permissions | change |
|
||||
| password | %public% |
|
||||
And the public has locked "textfile0.txt" in the last public link shared folder setting the following properties
|
||||
| lockscope | <lock-scope> |
|
||||
When the public unlocks file "textfile0.txt" using the WebDAV API
|
||||
Then the HTTP status code should be "204"
|
||||
And 0 locks should be reported for file "PARENT/textfile0.txt" of user "Alice" by the WebDAV API
|
||||
And user "Alice" should be able to upload file "filesForUpload/lorem.txt" to "PARENT/textfile0.txt"
|
||||
Examples:
|
||||
| dav-path-version | lock-scope |
|
||||
| old | shared |
|
||||
| old | exclusive |
|
||||
| new | shared |
|
||||
| new | exclusive |
|
||||
| spaces | shared |
|
||||
| spaces | exclusive |
|
||||
|
||||
@@ -68,8 +68,8 @@ class WebDavLockingContext implements Context {
|
||||
$user = $this->featureContext->getActualUsername($user);
|
||||
$baseUrl = $this->featureContext->getBaseUrl();
|
||||
if ($public === true) {
|
||||
$type = "public-files";
|
||||
$password = null;
|
||||
$type = "public-files-new";
|
||||
$password = $this->featureContext->getActualPassword("%public%");
|
||||
} else {
|
||||
$type = "files";
|
||||
$password = $this->featureContext->getPasswordForUser($user);
|
||||
@@ -318,7 +318,8 @@ class WebDavLockingContext implements Context {
|
||||
}
|
||||
|
||||
/**
|
||||
* @When the public locks the last public link shared file/folder using the WebDAV API setting the following properties
|
||||
* @When the public locks the last public link shared file using the WebDAV API setting the following properties
|
||||
* @When the public tries to lock the last public link shared file using the WebDAV API setting the following properties
|
||||
*
|
||||
* @param TableNode $properties
|
||||
*
|
||||
@@ -360,6 +361,7 @@ class WebDavLockingContext implements Context {
|
||||
|
||||
/**
|
||||
* @When /^the public locks "([^"]*)" in the last public link shared folder using the (old|new) public WebDAV API setting the following properties$/
|
||||
* @When /^the public tries to lock "([^"]*)" in the last public link shared folder using the (old|new) public WebDAV API setting the following properties$/
|
||||
*
|
||||
* @param string $file
|
||||
* @param string $publicWebDAVAPIVersion
|
||||
|
||||
Reference in New Issue
Block a user