diff --git a/tests/acceptance/config/behat-core.yml b/tests/acceptance/config/behat-core.yml index 1042f0dcc..10f45b29f 100644 --- a/tests/acceptance/config/behat-core.yml +++ b/tests/acceptance/config/behat-core.yml @@ -136,6 +136,7 @@ default: - TrashbinContext: - WebDavPropertiesContext: - OcisConfigContext: + - SharingNgContext: coreApiSharePublicLink2: paths: diff --git a/tests/acceptance/features/bootstrap/PublicWebDavContext.php b/tests/acceptance/features/bootstrap/PublicWebDavContext.php index 4e4e03149..9261e902d 100644 --- a/tests/acceptance/features/bootstrap/PublicWebDavContext.php +++ b/tests/acceptance/features/bootstrap/PublicWebDavContext.php @@ -332,17 +332,12 @@ class PublicWebDavContext implements Context { /** * @param string $path * @param string $user - * @param bool $shareNg * * @return ResponseInterface */ - public function downloadFromPublicLinkAsUser(string $path, string $user, bool $shareNg = false): ResponseInterface { + public function downloadFromPublicLinkAsUser(string $path, string $user): ResponseInterface { $path = \ltrim($path, "/"); - if ($shareNg) { - $token = $this->featureContext->shareNgGetLastCreatedLinkShareToken(); - } else { - $token = $this->featureContext->getLastCreatedPublicShareToken(); - } + $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( $token, diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index a9b8e359d..925b785e2 100755 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -3245,7 +3245,7 @@ trait Sharing { * @return void */ public function thePublicAccessesThePreviewOfTheSharedFileUsingTheSharingApi(string $path):void { - $token = $this->getLastCreatedPublicShareToken(); + $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $this->getPublicPreviewOfFile($path, $token); $this->pushToLastStatusCodesArrays(); } @@ -3266,7 +3266,7 @@ trait Sharing { $this->emptyLastHTTPStatusCodesArray(); $this->emptyLastOCSStatusCodesArray(); foreach ($paths as $path) { - $token = $this->getLastCreatedPublicShareToken(); + $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $this->getPublicPreviewOfFile($path["path"], $token); $this->pushToLastStatusCodesArrays(); } diff --git a/tests/acceptance/features/coreApiSharePublicLink1/accessToPublicLinkShare.feature b/tests/acceptance/features/coreApiSharePublicLink1/accessToPublicLinkShare.feature index 7c18cbaa6..27ea81b01 100644 --- a/tests/acceptance/features/coreApiSharePublicLink1/accessToPublicLinkShare.feature +++ b/tests/acceptance/features/coreApiSharePublicLink1/accessToPublicLinkShare.feature @@ -11,10 +11,12 @@ Feature: accessing a public link share Scenario: access to the preview of password protected public link without providing the password is not allowed Given user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "testavatar.jpg" - And user "Alice" has created a public link share with settings - | path | /testavatar.jpg | - | permissions | change | - | password | %public% | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | testavatar.jpg | + | space | Personal | + | permissionsRole | edit | + | password | %public% | When the public accesses the preview of file "testavatar.jpg" from the last shared public link using the sharing API Then the HTTP status code should be "404" @@ -22,9 +24,11 @@ Feature: accessing a public link share Scenario: access to the preview of public shared file without password Given the config "OCIS_SHARING_PUBLIC_SHARE_MUST_HAVE_PASSWORD" has been set to "false" And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "testavatar.jpg" - And user "Alice" has created a public link share with settings - | path | /testavatar.jpg | - | permissions | change | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | testavatar.jpg | + | space | Personal | + | permissionsRole | edit | When the public accesses the preview of file "testavatar.jpg" from the last shared public link using the sharing API Then the HTTP status code should be "200" @@ -33,10 +37,12 @@ Feature: accessing a public link share Given user "Alice" has created folder "FOLDER" And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "FOLDER/testavatar.jpg" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile0.txt" - And user "Alice" has created a public link share with settings - | path | /FOLDER | - | permissions | change | - | password | %public% | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | FOLDER | + | space | Personal | + | permissionsRole | edit | + | password | %public% | When the public accesses the preview of the following files from the last shared public link using the sharing API | path | | testavatar.jpg | @@ -49,9 +55,11 @@ Feature: accessing a public link share And user "Alice" has created folder "FOLDER" And user "Alice" has uploaded file "filesForUpload/testavatar.jpg" to "FOLDER/testavatar.jpg" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile0.txt" - And user "Alice" has created a public link share with settings - | path | /FOLDER | - | permissions | change | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | FOLDER | + | space | Personal | + | permissionsRole | edit | When the public accesses the preview of the following files from the last shared public link using the sharing API | path | | testavatar.jpg | @@ -62,9 +70,11 @@ Feature: accessing a public link share Scenario: user tries to download public link file using own basic auth And user "Alice" has created folder "FOLDER" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "FOLDER/textfile.txt" - And user "Alice" has created a public link share with settings - | path | FOLDER | - | permissions | change | - | password | %public% | + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | FOLDER | + | space | Personal | + | permissionsRole | edit | + | password | %public% | When user "Alice" tries to download file "textfile.txt" from the last public link using own basic auth and new public WebDAV API Then the HTTP status code should be "401"