changingPublicLinkShare.feature: Used sharingNG for sharing in given step

This commit is contained in:
Prarup Gurung
2024-05-15 17:50:46 +05:45
parent b0ec3008b9
commit 74094fb3a6
3 changed files with 111 additions and 100 deletions
+1
View File
@@ -136,6 +136,7 @@ default:
- TrashbinContext:
- WebDavPropertiesContext:
- OcisConfigContext:
- SpacesContext:
- SharingNgContext:
coreApiSharePublicLink2:
@@ -224,7 +224,7 @@ class PublicWebDavContext implements Context {
* @return ResponseInterface
*/
public function renameFileFromPublicShare(string $fileName, string $toFileName, string $publicWebDAVAPIVersion, ?string $password = ""):ResponseInterface {
$token = $this->featureContext->getLastCreatedPublicShareToken();
$token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken();
$davPath = WebDavHelper::getDavPath(
$token,
0,
@@ -14,67 +14,79 @@ Feature: changing a public link share
Scenario Outline: public can or cannot delete file through publicly shared link depending on having delete permissions using the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | <permissions> |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | <permissions-role> |
| password | %public% |
When the public deletes file "parent.txt" from the last public link share using the password "%public%" and new public WebDAV API
Then the HTTP status code should be "<http-status-code>"
And as "Alice" file "PARENT/parent.txt" <should-or-not> exist
Examples:
| permissions | http-status-code | should-or-not |
| read | 403 | should |
| read,create | 403 | should |
| create | 403 | should |
| read,update,create,delete | 204 | should not |
| permissions-role | http-status-code | should-or-not |
| view | 403 | should |
| upload | 403 | should |
| createOnly | 403 | should |
| edit | 204 | should not |
Scenario: public link share permissions work correctly for renaming and share permissions read,update,create,delete using the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | read,update,create,delete |
| password | %public% |
Scenario: public link share permissions work correctly for renaming and share permissions edit using the public WebDAV API
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public renames file "parent.txt" to "newparent.txt" from the last public link share using the password "%public%" and the new public WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "/PARENT/parent.txt" should not exist
And as "Alice" file "/PARENT/newparent.txt" should exist
Scenario: public link share permissions work correctly for upload with share permissions read,update,create,delete with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | read,update,create,delete |
| password | %public% |
Scenario: public link share permissions work correctly for upload with share permissions edit with the public WebDAV API
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public uploads file "lorem.txt" with password "%public%" and content "test" using the new public WebDAV API
Then the HTTP status code should be "201"
And the content of file "PARENT/lorem.txt" for user "Alice" should be "test"
Scenario: public cannot delete file through publicly shared link with password using an invalid password with public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | change |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public deletes file "parent.txt" from the last public link share using the password "invalid" and new public WebDAV API
Then the HTTP status code should be "401"
And as "Alice" file "PARENT/parent.txt" should exist
Scenario: public can delete file through publicly shared link with password using the valid password with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | change |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public deletes file "parent.txt" from the last public link share using the password "%public%" and new public WebDAV API
Then the HTTP status code should be "204"
And as "Alice" file "PARENT/parent.txt" should not exist
Scenario: public tries to rename a file in a password protected share using an invalid password with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | change |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public renames file "parent.txt" to "newparent.txt" from the last public link share using the password "invalid" and the new public WebDAV API
Then the HTTP status code should be "401"
And as "Alice" file "/PARENT/newparent.txt" should not exist
@@ -82,10 +94,12 @@ Feature: changing a public link share
Scenario: public tries to rename a file in a password protected share using the valid password with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | change |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public renames file "parent.txt" to "newparent.txt" from the last public link share using the password "%public%" and the new public WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "/PARENT/newparent.txt" should exist
@@ -93,30 +107,36 @@ Feature: changing a public link share
Scenario: public tries to upload to a password protected public share using an invalid password with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | change |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public uploads file "lorem.txt" with password "invalid" and content "test" using the new public WebDAV API
Then the HTTP status code should be "401"
And as "Alice" file "/PARENT/lorem.txt" should not exist
Scenario: public tries to upload to a password protected public share using the valid password with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | change |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When the public uploads file "lorem.txt" with password "%public%" and content "test" using the new public WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "/PARENT/lorem.txt" should exist
Scenario: public cannot rename a file in upload-write-only public link share with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | uploadwriteonly |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | createOnly |
| password | %public% |
When the public renames file "parent.txt" to "newparent.txt" from the last public link share using the password "%public%" and the new public WebDAV API
Then the HTTP status code should be "403"
And as "Alice" file "/PARENT/parent.txt" should exist
@@ -124,10 +144,12 @@ Feature: changing a public link share
Scenario: public cannot delete a file in upload-write-only public link share with the public WebDAV API
Given user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | uploadwriteonly |
| password | %public% |
Given using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | createOnly |
| password | %public% |
When the public deletes file "parent.txt" from the last public link share using the password "%public%" and new public WebDAV API
Then the HTTP status code should be "403"
And as "Alice" file "PARENT/parent.txt" should exist
@@ -135,10 +157,12 @@ Feature: changing a public link share
@skipOnReva
Scenario Outline: normal user tries to remove password of a public link share (change/create permission)
Given using OCS API version "<ocs-api-version>"
And user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | <permissions> |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | <permissions-role> |
| password | %public% |
When user "Alice" updates the last public link share using the sharing API with
| path | /PARENT |
| permissions | <permissions> |
@@ -147,19 +171,21 @@ Feature: changing a public link share
And the OCS status code should be "400"
And the OCS status message should be "missing required password"
Examples:
| ocs-api-version | permissions | http-status-code |
| 1 | change | 200 |
| 2 | change | 400 |
| 1 | create | 200 |
| 2 | create | 400 |
| ocs-api-version | permissions | permissions-role | http-status-code |
| 1 | change | edit | 200 |
| 2 | change | edit | 400 |
| 1 | create | createOnly | 200 |
| 2 | create | createOnly | 400 |
@issue-7821 @skipOnReva
Scenario Outline: normal user tries to remove password of a public link (update without sending permissions)
Given using OCS API version "<ocs-api-version>"
And user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | change |
| password | %public% |
And using SharingNG
And user "Alice" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | edit |
| password | %public% |
When user "Alice" updates the last public link share using the sharing API with
| path | /PARENT |
| password | |
@@ -171,36 +197,18 @@ Feature: changing a public link share
| 1 | 200 |
| 2 | 403 |
Scenario Outline: normal user removes password of a public link (invite only public link)
Given using OCS API version "<ocs-api-version>"
And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "PARENT/parent.txt"
And user "Alice" has created a public link share with settings
| path | /PARENT |
| permissions | invite |
| password | %public% |
When user "Alice" updates the last public link share using the sharing API with
| path | /PARENT |
| password | |
| permissions | invite |
Then the HTTP status code should be "200"
And the OCS status code should be "<ocs-status-code>"
And the OCS status message should be "OK"
Examples:
| ocs-api-version | ocs-status-code |
| 1 | 100 |
| 2 | 200 |
@skipOnReva # reva doesn't have a pre-created admin user
Scenario Outline: administrator removes password of a read-only public link
Given using OCS API version "<ocs-api-version>"
And admin has created folder "/PARENT"
And user "admin" has uploaded file "filesForUpload/textfile.txt" to "PARENT/parent.txt"
And user "admin" has created a public link share with settings
| path | /PARENT |
| permissions | read |
| password | %public% |
When user "admin" updates the last public link share using the sharing API with
And user "Admin" has uploaded file "filesForUpload/textfile.txt" to "PARENT/parent.txt"
And using SharingNG
And user "Admin" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | view |
| password | %public% |
When user "Admin" updates the last public link share using the sharing API with
| path | /PARENT |
| permissions | read |
| password | |
@@ -216,10 +224,12 @@ Feature: changing a public link share
Scenario Outline: administrator tries to remove password of a public link share (change/create permission)
Given using OCS API version "<ocs-api-version>"
And admin has created folder "/PARENT"
And user "admin" has created a public link share with settings
| path | /PARENT |
| permissions | <permissions> |
| password | %public% |
And using SharingNG
And user "Admin" has created the following resource link share:
| resource | PARENT |
| space | Personal |
| permissionsRole | <permissions-role> |
| password | %public% |
When user "admin" updates the last public link share using the sharing API with
| path | /PARENT |
| permissions | <permissions> |
@@ -228,8 +238,8 @@ Feature: changing a public link share
And the OCS status code should be "400"
And the OCS status message should be "missing required password"
Examples:
| ocs-api-version | permissions | http-status-code |
| 1 | change | 200 |
| 2 | change | 400 |
| 1 | create | 200 |
| 2 | create | 400 |
| ocs-api-version | permissions | permissions-role | http-status-code |
| 1 | change | edit | 200 |
| 2 | change | edit | 400 |
| 1 | create | createOnly | 200 |
| 2 | create | createOnly | 400 |