From f98304cac62906cca9a0d7c82fb5f2c40fa13938 Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Fri, 17 May 2024 15:17:11 +0545 Subject: [PATCH 1/2] listFiles.feature: Used sharingNG for sharing in given step --- tests/acceptance/config/behat-core.yml | 2 ++ tests/acceptance/features/bootstrap/WebDav.php | 12 ++++-------- .../coreApiWebdavOperations/listFiles.feature | 12 ++++++++++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/acceptance/config/behat-core.yml b/tests/acceptance/config/behat-core.yml index 62c2e7e0d7..696f4b0374 100644 --- a/tests/acceptance/config/behat-core.yml +++ b/tests/acceptance/config/behat-core.yml @@ -253,6 +253,8 @@ default: - FeatureContext: *common_feature_context_params - SearchContext: - PublicWebDavContext: + - SpacesContext: + - SharingNgContext: - WebDavPropertiesContext: - TrashbinContext: - OcisConfigContext: diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index ae6ede1708..abfb99a3d4 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -5463,16 +5463,12 @@ trait WebDav { * @throws Exception */ public function theLastPublicDavResponseShouldContainTheseNodes(TableNode $table):void { - if ($this->isUsingSharingNG()) { - $user = $this->shareNgGetLastCreatedLinkShareToken(); - } else { - $user = $this->getLastCreatedPublicShareToken(); - } + $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $this->verifyTableNodeColumns($table, ["name"]); $type = $this->usingOldDavPath ? "public-files" : "public-files-new"; foreach ($table->getHash() as $row) { $path = $this->substituteInLineCodes($row['name']); - $res = $this->findEntryFromPropfindResponse($path, $user, $type); + $res = $this->findEntryFromPropfindResponse($path, $token, $type); Assert::assertNotFalse($res, "expected $path to be in DAV response but was not found"); } } @@ -5486,12 +5482,12 @@ trait WebDav { * @throws Exception */ public function theLastPublicDavResponseShouldNotContainTheseNodes(TableNode $table):void { - $user = $this->getLastCreatedPublicShareToken(); + $token = ($this->isUsingSharingNG()) ? $this->shareNgGetLastCreatedLinkShareToken() : $this->getLastCreatedPublicShareToken(); $this->verifyTableNodeColumns($table, ["name"]); $type = $this->usingOldDavPath ? "public-files" : "public-files-new"; foreach ($table->getHash() as $row) { $path = $this->substituteInLineCodes($row['name']); - $res = $this->findEntryFromPropfindResponse($path, $user, $type); + $res = $this->findEntryFromPropfindResponse($path, $token, $type); Assert::assertFalse($res, "expected $path to not be in DAV response but was found"); } } diff --git a/tests/acceptance/features/coreApiWebdavOperations/listFiles.feature b/tests/acceptance/features/coreApiWebdavOperations/listFiles.feature index 8641d8e823..1cde683359 100644 --- a/tests/acceptance/features/coreApiWebdavOperations/listFiles.feature +++ b/tests/acceptance/features/coreApiWebdavOperations/listFiles.feature @@ -132,7 +132,11 @@ Feature: list files | path | | /simple-folder/simple-folder1/simple-folder2/simple-folder3 | | /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 | - And user "Alice" has created a public link share of folder "simple-folder" + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | simple-folder | + | space | Personal | + | permissionsRole | view | When the public lists the resources in the last created public link with depth "0" using the WebDAV API Then the HTTP status code should be "207" And the last public link DAV response should not contain these nodes @@ -156,7 +160,11 @@ Feature: list files | path | | /simple-folder/simple-folder1/simple-folder2/simple-folder3 | | /simple-folder/simple-folder1/simple-folder2/simple-folder3/simple-folder4 | - And user "Alice" has created a public link share of folder "simple-folder" + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | simple-folder | + | 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 last public link DAV response should contain these nodes From 87179595406d12055c1ad2ebdbc248ed5c29ea1f Mon Sep 17 00:00:00 2001 From: Prarup Gurung Date: Fri, 17 May 2024 15:34:13 +0545 Subject: [PATCH 2/2] propfind.feature: Used sharingNG for sharing in given step --- tests/acceptance/config/behat-core.yml | 1 - .../bootstrap/PublicWebDavContext.php | 2 +- .../coreApiWebdavOperations/propfind.feature | 30 +++++++++++-------- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/tests/acceptance/config/behat-core.yml b/tests/acceptance/config/behat-core.yml index 696f4b0374..25bd0f6c1e 100644 --- a/tests/acceptance/config/behat-core.yml +++ b/tests/acceptance/config/behat-core.yml @@ -253,7 +253,6 @@ default: - FeatureContext: *common_feature_context_params - SearchContext: - PublicWebDavContext: - - SpacesContext: - SharingNgContext: - WebDavPropertiesContext: - TrashbinContext: diff --git a/tests/acceptance/features/bootstrap/PublicWebDavContext.php b/tests/acceptance/features/bootstrap/PublicWebDavContext.php index 1a2c4e1afa..199b4caf6d 100644 --- a/tests/acceptance/features/bootstrap/PublicWebDavContext.php +++ b/tests/acceptance/features/bootstrap/PublicWebDavContext.php @@ -1871,7 +1871,7 @@ class PublicWebDavContext implements Context { } else { $body = null; } - $token = $this->featureContext->getLastCreatedPublicShareToken(); + $token = ($this->featureContext->isUsingSharingNG()) ? $this->featureContext->shareNgGetLastCreatedLinkShareToken() : $this->featureContext->getLastCreatedPublicShareToken(); $davPath = WebDavHelper::getDavPath( null, null, diff --git a/tests/acceptance/features/coreApiWebdavOperations/propfind.feature b/tests/acceptance/features/coreApiWebdavOperations/propfind.feature index 9fae2789e4..7c8aa28dea 100644 --- a/tests/acceptance/features/coreApiWebdavOperations/propfind.feature +++ b/tests/acceptance/features/coreApiWebdavOperations/propfind.feature @@ -48,10 +48,12 @@ Feature: PROPFIND Scenario: send PROPFIND request to a public link shared with password Given user "Alice" has been created with default attributes and without skeleton files And user "Alice" has created folder "/PARENT" - 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 the public sends "PROPFIND" request to the last public link share using the new public WebDAV API with password "%public%" Then the HTTP status code should be "207" And the value of the item "//d:href" in the response should match "/%base_path%\/remote.php\/dav\/public-files\/%public_token%\/$/" @@ -61,10 +63,12 @@ Feature: PROPFIND Scenario: send PROPFIND request to a public link shared with password (request without password) Given user "Alice" has been created with default attributes and without skeleton files And user "Alice" has created folder "/PARENT" - 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 the public sends "PROPFIND" request to the last public link share using the new public WebDAV API Then the HTTP status code should be "401" And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotAuthenticated" @@ -73,10 +77,12 @@ Feature: PROPFIND Scenario: send PROPFIND request to a public link shared with password (request with incorrect password) Given user "Alice" has been created with default attributes and without skeleton files And user "Alice" has created folder "/PARENT" - 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 the public sends "PROPFIND" request to the last public link share using the new public WebDAV API with password "1234" Then the HTTP status code should be "401" And the value of the item "/d:error/s:exception" in the response should be "Sabre\DAV\Exception\NotAuthenticated"