From fa998e46000e9a0d1de3b66d2472282088385e2c Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Thu, 8 Sep 2022 15:03:35 +0545 Subject: [PATCH] Reuse code from core for shareOperation --- .../apiSpaces/shareOperations.feature | 20 +++++++------- .../features/bootstrap/SpacesContext.php | 26 ++----------------- 2 files changed, 12 insertions(+), 34 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/shareOperations.feature b/tests/acceptance/features/apiSpaces/shareOperations.feature index 708007b59..896ec6f0e 100644 --- a/tests/acceptance/features/apiSpaces/shareOperations.feature +++ b/tests/acceptance/features/apiSpaces/shareOperations.feature @@ -17,7 +17,7 @@ Feature: sharing When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "19" @@ -34,7 +34,7 @@ Feature: sharing When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "19" @@ -61,7 +61,7 @@ Feature: sharing When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "3" @@ -88,7 +88,7 @@ Feature: sharing When user "Brian" gets the following properties of file "/tmp.txt" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "17" @@ -99,7 +99,7 @@ Feature: sharing When user "Brian" gets the following properties of folder "/tmp" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "31" @@ -115,7 +115,7 @@ Feature: sharing When user "Brian" gets the following properties of folder "/tmp" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "31" @@ -142,7 +142,7 @@ Feature: sharing When user "Brian" gets the following properties of folder "/tmp" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "29" @@ -169,7 +169,7 @@ Feature: sharing When user "Brian" gets the following properties of folder "/tmp" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "27" @@ -196,7 +196,7 @@ Feature: sharing When user "Brian" gets the following properties of folder "/tmp" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "23" @@ -223,7 +223,7 @@ Feature: sharing When user "Brian" gets the following properties of folder "/tmp" inside space "Shares Jail" using the WebDAV API | propertyName | | ocs:share-permissions | - Then the HTTP status code should be "207" + Then the HTTP status code should be "200" And the single response should contain a property "ocs:share-permissions" with value "15" diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 61bcfa885..2a1dc6eaa 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -3122,30 +3122,8 @@ class SpacesContext implements Context { string $spaceName, TableNode $propertiesTable ):void { - $space = $this->getSpaceByName($user, $spaceName); - $properties = null; - $fullUrl = $space["root"]["webDavUrl"] . '/' . ltrim($resourceName, "/"); - $this->featureContext->verifyTableNodeColumns($propertiesTable, ["propertyName"]); - $this->featureContext->verifyTableNodeColumnsCount($propertiesTable, 1); - if ($propertiesTable instanceof TableNode) { - foreach ($propertiesTable->getColumnsHash() as $row) { - $properties[] = $row["propertyName"]; - } - } - $body = WebDavHelper::getBodyForPropfind($properties); - $headers['Depth'] = '1'; - $this->featureContext->setResponse( - $this->sendPropfindRequestToUrl( - $fullUrl, - $user, - $this->featureContext->getPasswordForUser($user), - '', - $headers, - $body - ) - ); - $responseXml = $this->featureContext->getResponseXml(null, __METHOD__); - $this->featureContext->setResponseXmlObject($responseXml); + $this->setSpaceIDByName($user, $spaceName); + $this->webDavPropertiesContext->userGetsPropertiesOfFolder($user, $resourceName, $propertiesTable); } /**