From bb6cb7d7a34045ce1a35a5cc7c1c4681f56b3442 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Wed, 15 May 2024 14:14:21 +0545 Subject: [PATCH] createPublicLinkShare.feature: Used sharingNG for sharing in given step --- .../expected-failures-API-on-OCIS-storage.md | 2 +- .../bootstrap/PublicWebDavContext.php | 2 +- .../acceptance/features/bootstrap/WebDav.php | 3 +- .../createPublicLinkShare.feature | 54 +++++++++++-------- 4 files changed, 36 insertions(+), 25 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 541a1451e..b8978b48e 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -90,7 +90,7 @@ cannot share a folder with create permission #### [Public link enforce permissions](https://github.com/owncloud/ocis/issues/1269) -- [coreApiSharePublicLink1/createPublicLinkShare.feature:288](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L288) +- [coreApiSharePublicLink1/createPublicLinkShare.feature:290](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature#L290) #### [copying a folder within a public link folder to folder with same name as an already existing file overwrites the parent file](https://github.com/owncloud/ocis/issues/1232) diff --git a/tests/acceptance/features/bootstrap/PublicWebDavContext.php b/tests/acceptance/features/bootstrap/PublicWebDavContext.php index ed361faa6..7aa20fa6a 100644 --- a/tests/acceptance/features/bootstrap/PublicWebDavContext.php +++ b/tests/acceptance/features/bootstrap/PublicWebDavContext.php @@ -1696,7 +1696,7 @@ class PublicWebDavContext implements Context { string $fileName, string $mtime ):void { - $token = $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); $baseUrl = $this->featureContext->getBaseUrl(); $mtime = \explode(" ", $mtime); \array_pop($mtime); diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 9eb6e7e14..8d1450975 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -1473,8 +1473,7 @@ trait WebDav { * @throws Exception */ public function publicGetsSizeOfLastSharedPublicLinkUsingTheWebdavApi():void { - $tokenArray = $this->getLastCreatedPublicShare()->token; - $token = (string)$tokenArray[0]; + $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $url = $this->getBaseUrl() . "/remote.php/dav/public-files/$token"; $this->response = HttpRequestHelper::sendRequest( $url, diff --git a/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature b/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature index defff9e8b..98d851b0f 100644 --- a/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature +++ b/tests/acceptance/features/coreApiSharePublicLink1/createPublicLinkShare.feature @@ -277,10 +277,12 @@ Feature: create a public link share Scenario: delete a folder that has been publicly shared and try to access using the public WebDAV API Given user "Alice" has created folder "PARENT" And user "Alice" has uploaded file with content "Random data" to "/PARENT/parent.txt" - And user "Alice" has created a public link share with settings - | path | PARENT | - | permissions | read | - | password | %public% | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | PARENT | + | space | Personal | + | permissionsRole | view | + | password | %public% | When user "Alice" deletes folder "/PARENT" using the WebDAV API Then the public download of file "/parent.txt" from inside the last public link shared folder using the new public WebDAV API with password "%public%" should fail with HTTP status code "404" @@ -288,10 +290,12 @@ Feature: create a public link share Scenario: try to download from a public share that has upload only permissions using the public webdav api Given user "Alice" has created folder "PARENT" And user "Alice" has uploaded file with content "Random data" to "/PARENT/parent.txt" - And user "Alice" has created a public link share with settings - | path | PARENT | - | permissions | uploadwriteonly | - | password | %public% | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | PARENT | + | space | Personal | + | permissionsRole | createOnly | + | password | %public% | When the public downloads file "parent.txt" from inside the last public link shared folder using the new public WebDAV API Then the value of the item "//s:message" in the response should be "File not found: parent.txt" And the HTTP status code should be "404" @@ -300,9 +304,11 @@ Feature: create a public link share Scenario: get the size of a file shared by public link Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" And user "Alice" has uploaded file with content "This is a test file" to "test-file.txt" - And user "Alice" has created a public link share with settings - | path | test-file.txt | - | permissions | read | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | test-file.txt | + | space | Personal | + | permissionsRole | view | When the public gets the size of the last shared public link using the WebDAV API Then the HTTP status code should be "207" And the size of the file should be "19" @@ -342,9 +348,11 @@ Feature: create a public link share Scenario: get the mtime of a file inside a folder shared by public link using new webDAV version Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" And user "Alice" has created folder "testFolder" - And user "Alice" has created a public link share with settings - | path | /testFolder | - | permissions | read,update,create,delete | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | testFolder | + | space | Personal | + | permissionsRole | edit | When the public uploads file "file.txt" to the last public link shared folder with password "%public%" with mtime "Thu, 08 Aug 2019 04:18:13 GMT" using the new public WebDAV API Then the HTTP status code should be "201" And as "Alice" file "testFolder/file.txt" should exist @@ -370,9 +378,11 @@ Feature: create a public link share Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" And using new DAV path And user "Alice" has uploaded file with content "Random data" to "/file.txt" - And user "Alice" has created a public link share with settings - | path | file.txt | - | permissions | read | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | file.txt | + | space | Personal | + | permissionsRole | view | When the public lists the resources in the last created public link with depth "1" using the WebDAV API Then the HTTP status code should be "207" And the value of the item "//d:response[2]//d:href" in the response should match "/%base_path%\/remote.php\/dav\/public-files\/%public_token%\/file.txt$/" @@ -386,10 +396,12 @@ Feature: create a public link share Scenario Outline: create a password-protected public link on a file with the name same to the previously deleted one Given using OCS API version "" And user "Alice" has uploaded file with content "test data 1" to "/test.txt" - And user "Alice" has created a public link share with settings - | path | test.txt | - | permissions | read | - | password | %public% | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | test.txt | + | space | Personal | + | permissionsRole | view | + | password | %public% | And user "Alice" has deleted file "test.txt" When user "Alice" updates the last public link share using the sharing API with | password | Test:123345 |