From eab79a427fc2beda5eae5dfe465a02c91599bc30 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Fri, 16 Dec 2022 10:08:03 +0545 Subject: [PATCH] Extended public link tests to have more checks --- ...ected-failures-localAPI-on-OCIS-storage.md | 9 + .../shareSpacesViaLink.feature | 178 +++++++++--------- .../shareSubItemOfSpaceViaPublicLink.feature | 84 ++++++--- 3 files changed, 152 insertions(+), 119 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 8cffa1a100..4ac319d5da 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -79,6 +79,15 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiCors/cors.feature:67](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L67) - [apiCors/cors.feature:68](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiCors/cors.feature#L68) +#### [POST response does not return correct path when creating public link](https://github.com/owncloud/ocis/issues/5139) +- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:62](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L62) +- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:63](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L63) +- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L64) +- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:90](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L90) +- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:160](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L160) +- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:161](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L161) +- [apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature:162](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature#L162) + #### [Public cannot download folder via the public link of the folder inside the project space](https://github.com/owncloud/ocis/issues/5229) - [apiSpacesShares/publicLinkDownload.feature:30](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesShares/publicLinkDownload.feature#L30) diff --git a/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature b/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature index 0160617a7c..7104ba45c1 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSpacesViaLink.feature @@ -1,103 +1,103 @@ @api @skipOnOcV10 Feature: Share spaces via link - As the manager of a space - I want to be able to share a space via public link + As the manager of a space + I want to be able to share a space via public link - Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production - See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839 + Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production + See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839 - Background: - Given these users have been created with default attributes and without skeleton files: - | username | - | Alice | - | Brian | - And using spaces DAV path - And the administrator has given "Alice" the role "Space Admin" using the settings api - And user "Alice" has created a space "share space" with the default quota using the GraphApi - And user "Alice" has uploaded a file inside space "share space" with content "some content" to "test.txt" + Background: + Given these users have been created with default attributes and without skeleton files: + | username | + | Alice | + | Brian | + And using spaces DAV path + And the administrator has given "Alice" the role "Space Admin" using the settings api + And user "Alice" has created a space "share space" with the default quota using the GraphApi + And user "Alice" has uploaded a file inside space "share space" with content "some content" to "test.txt" - Scenario Outline: A manager can share a space to public via link with different permissions - When user "Alice" creates a public link share of the space "share space" with settings: - | permissions | | - | password | | - | name | | - | expireDate | | - Then the HTTP status code should be "200" - And the OCS status code should be "200" - And the OCS status message should be "OK" - And the fields of the last response to user "Alice" should include - | item_type | folder | - | mimetype | httpd/unix-directory | - | file_target | / | - | path | / | - | permissions | | - | share_type | public_link | - | displayname_owner | %displayname% | - | uid_owner | %username% | - | name | | - And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "" - And the downloaded content should be "some content" - But the public should not be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "wrong pass" - Examples: - | permissions | expectedPermissions | password | linkName | expireDate | - | 1 | read | 123234 | link | 2042-03-25T23:59:59+0100 | - | 5 | read,create | qwerty 123 | | 2042-03-25T23:59:59+0100 | - | 15 | read,update,create,delete | d*V^o*Y03R9n8Z | link | | + Scenario Outline: A manager can share a space to public via link with different permissions + When user "Alice" creates a public link share of the space "share space" with settings: + | permissions | | + | password | | + | name | | + | expireDate | | + Then the HTTP status code should be "200" + And the OCS status code should be "200" + And the OCS status message should be "OK" + And the fields of the last response to user "Alice" should include + | item_type | folder | + | mimetype | httpd/unix-directory | + | file_target | / | + | path | / | + | permissions | | + | share_type | public_link | + | displayname_owner | %displayname% | + | uid_owner | %username% | + | name | | + And the public should be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "" + And the downloaded content should be "some content" + But the public should not be able to download file "/test.txt" from inside the last public link shared folder using the new public WebDAV API with password "wrong pass" + Examples: + | permissions | expectedPermissions | password | linkName | expireDate | + | 1 | read | 123234 | link | 2042-03-25T23:59:59+0100 | + | 5 | read,create | qwerty 123 | | 2042-03-25T23:59:59+0100 | + | 15 | read,update,create,delete | d*V^o*Y03R9n8Z | link | | - Scenario: An uploader should be able to upload a file - When user "Alice" creates a public link share of the space "share space" with settings: - | permissions | 4 | - | password | 123 | - | name | forUpload | - | expireDate | 2042-03-25T23:59:59+0100 | - Then the HTTP status code should be "200" - And the OCS status code should be "200" - And the OCS status message should be "OK" - And the fields of the last response to user "Alice" should include - | item_type | folder | - | mimetype | httpd/unix-directory | - | file_target | / | - | path | / | - | permissions | create | - | share_type | public_link | - | displayname_owner | %displayname% | - | uid_owner | %username% | - | name | forUpload | - And the public should be able to upload file "lorem.txt" into the last public link shared folder using the new public WebDAV API with password "123" - And for user "Alice" the space "share space" should contain these entries: - | lorem.txt | + Scenario: An uploader should be able to upload a file + When user "Alice" creates a public link share of the space "share space" with settings: + | permissions | 4 | + | password | 123 | + | name | forUpload | + | expireDate | 2042-03-25T23:59:59+0100 | + Then the HTTP status code should be "200" + And the OCS status code should be "200" + And the OCS status message should be "OK" + And the fields of the last response to user "Alice" should include + | item_type | folder | + | mimetype | httpd/unix-directory | + | file_target | / | + | path | / | + | permissions | create | + | share_type | public_link | + | displayname_owner | %displayname% | + | uid_owner | %username% | + | name | forUpload | + And the public should be able to upload file "lorem.txt" into the last public link shared folder using the new public WebDAV API with password "123" + And for user "Alice" the space "share space" should contain these entries: + | lorem.txt | - Scenario Outline: An user without manager role cannot share a space to public via link - Given user "Alice" has shared a space "share space" to user "Brian" with role "" - When user "Brian" creates a public link share of the space "share space" with settings: - | permissions | 1 | - Then the HTTP status code should be "404" - And the OCS status code should be "404" - And the OCS status message should be "No share permission" - And for user "Alice" the space "share space" should not contain the last created public link - Examples: - | role | - | viewer | - | editor | + Scenario Outline: An user without manager role cannot share a space to public via link + Given user "Alice" has shared a space "share space" to user "Brian" with role "" + When user "Brian" creates a public link share of the space "share space" with settings: + | permissions | 1 | + Then the HTTP status code should be "404" + And the OCS status code should be "404" + And the OCS status message should be "No share permission" + And for user "Alice" the space "share space" should not contain the last created public link + Examples: + | role | + | viewer | + | editor | - Scenario: An user with manager role can share a space to public via link - Given user "Alice" has shared a space "share space" to user "Brian" with role "manager" - When user "Brian" creates a public link share of the space "share space" with settings: - | permissions | 1 | - Then the HTTP status code should be "200" - And the OCS status code should be "200" - And for user "Alice" the space "share space" should contain the last created public link + Scenario: An user with manager role can share a space to public via link + Given user "Alice" has shared a space "share space" to user "Brian" with role "manager" + When user "Brian" creates a public link share of the space "share space" with settings: + | permissions | 1 | + Then the HTTP status code should be "200" + And the OCS status code should be "200" + And for user "Alice" the space "share space" should contain the last created public link - Scenario: A user cannot share a disabled space to public via link - Given user "Alice" has disabled a space "share space" - When user "Alice" creates a public link share of the space "share space" with settings: - | permissions | 1 | - Then the HTTP status code should be "404" - And the OCS status code should be "404" - And the OCS status message should be "Wrong path, file/folder doesn't exist" - And for user "Alice" the space "share space" should not contain the last created public link + Scenario: A user cannot share a disabled space to public via link + Given user "Alice" has disabled a space "share space" + When user "Alice" creates a public link share of the space "share space" with settings: + | permissions | 1 | + Then the HTTP status code should be "404" + And the OCS status code should be "404" + And the OCS status message should be "Wrong path, file/folder doesn't exist" + And for user "Alice" the space "share space" should not contain the last created public link diff --git a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature index 42fc6734ae..cc62dcc820 100644 --- a/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature +++ b/tests/acceptance/features/apiSpacesShares/shareSubItemOfSpaceViaPublicLink.feature @@ -1,21 +1,21 @@ @api @skipOnOcV10 Feature: Share a file or folder that is inside a space via public link - As an user with manager space role - I want to be able to share the data inside the space via public link + As an user with manager space role + I want to be able to share the data inside the space via public link - folder permissions: - | role | permissions | - | internal | 0 | - | viewer | 1 | - | uploader | 4 | - | contributor | 5 | - | editor | 15 | + folder permissions: + | role | permissions | + | internal | 0 | + | viewer | 1 | + | uploader | 4 | + | contributor | 5 | + | editor | 15 | - file permissions: - | role | permissions | - | internal | 0 | - | viewer | 1 | - | editor | 3 | + file permissions: + | role | permissions | + | internal | 0 | + | viewer | 1 | + | editor | 3 | Note - this feature is run in CI with ACCOUNTS_HASH_DIFFICULTY set to the default for production See https://github.com/owncloud/ocis/issues/1542 and https://github.com/owncloud/ocis/pull/839 @@ -44,17 +44,24 @@ Feature: Share a file or folder that is inside a space via public link And the OCS status code should be "200" And the OCS status message should be "OK" And the fields of the last response to user "Alice" should include - | path | | + | item_type | | + | mimetype | | + | file_target | | + | path | / | + | permissions | | + | share_type | public_link | + | displayname_owner | %displayname% | + | name | | Examples: - | entity | path | permissions | password | name | expireDate | - | folder | /folder |0 | | link | | - | folder | /folder |1 | 123 | link | 2042-03-25T23:59:59+0100 | - | folder | /folder |4 | | | | - | folder | /folder |5 | 200 | | 2042-03-25T23:59:59+0100 | - | folder | /folder |15 | | link | | - | folder/file.txt | /file.txt |0 | 123 | link | 2042-03-25T23:59:59+0100 | - | folder/file.txt | /file.txt |1 | 123 | link | 2042-03-25T23:59:59+0100 | - | folder/file.txt | /file.txt |3 | 123 | link | 2042-03-25T23:59:59+0100 | + | entity | file_target | permissions | password | name | expireDate | item_type | mimetype | + | folder | /folder | 0 | | link | | folder | httpd/unix-directory | + | folder | /folder | 1 | 123 | link | 2042-03-25T23:59:59+0100 | folder | httpd/unix-directory | + | folder | /folder | 4 | | | | folder | httpd/unix-directory | + | folder | /folder | 5 | 200 | | 2042-03-25T23:59:59+0100 | folder | httpd/unix-directory | + | folder | /folder | 15 | | link | | folder | httpd/unix-directory | + | folder/file.txt | /file.txt | 0 | 123 | link | 2042-03-25T23:59:59+0100 | file | text/plain | + | folder/file.txt | /file.txt | 1 | 123 | link | 2042-03-25T23:59:59+0100 | file | text/plain | + | folder/file.txt | /file.txt | 3 | 123 | link | 2042-03-25T23:59:59+0100 | file | text/plain | Scenario Outline: An user participant of the project space with space manager role can share an entity inside project space via public link @@ -69,12 +76,18 @@ Feature: Share a file or folder that is inside a space via public link Then the HTTP status code should be "200" And the OCS status code should be "200" And the OCS status message should be "OK" - And the fields of the last response to user "Alice" should include - | path | | + And the fields of the last response to user "Brian" should include + | item_type | | + | mimetype | | + | file_target | | + | path | / | + | share_type | public_link | + | displayname_owner | %displayname% | + | name | public link | Examples: - | entity | path | - | folder | /folder | - | folder/file.txt | /file.txt | + | entity | file_target | item_type | mimetype | + | folder | /folder | folder | httpd/unix-directory | + | folder/file.txt | /file.txt | file | text/plain | Scenario Outline: An user participant of the project space without space manager role cannot share an entity inside project space via public link @@ -130,7 +143,18 @@ Feature: Share a file or folder that is inside a space via public link | path | folder/file.txt | | shareType | 3 | | permissions | 1 | - Then for user "Brian" the space "share sub-item" should contain the last created public link of the file "folder/file.txt" + Then the fields of the last response to user "Alice" should include + | item_type | file | + | mimetype | text/plain | + | file_target | /file.txt | + | path | folder/file.txt | + | permissions | 1 | + | share_type | public_link | + | displayname_file_owner | %displayname% | + | displayname_owner | %displayname% | + | uid_file_owner | %username% | + | uid_owner | %username% | + And for user "Brian" the space "share sub-item" should contain the last created public link of the file "folder/file.txt" Examples: | spaceRole | | editor |