From 903131f76782a3e0251c16cbc75bcc67e3f96ca7 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 5 Aug 2024 10:05:52 +0545 Subject: [PATCH 1/3] test: adjust MOVE related tests --- .../expected-failures-localAPI-on-OCIS-storage.md | 8 +++----- .../features/apiSpacesDavOperation/moveByFileId.feature | 2 -- .../features/apiSpacesShares/moveSpaces.feature | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 758a28a57..6e7546c92 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -262,14 +262,12 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiSharingNg1/removeAccessToDrive.feature:206](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature#L206) - [apiSharingNg1/removeAccessToDrive.feature:236](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSharingNg1/removeAccessToDrive.feature#L236) -### [sharee (editor role) MOVE a file by file-id into same shared folder returns 403](https://github.com/owncloud/ocis/issues/7617) +### [sharee (editor role) MOVE a file by file-id into shared sub-folder returns 502](https://github.com/owncloud/ocis/issues/7617) - [apiSpacesDavOperation/moveByFileId.feature:469](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L469) - [apiSpacesDavOperation/moveByFileId.feature:470](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L470) -- [apiSpacesDavOperation/moveByFileId.feature:492](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L492) -- [apiSpacesDavOperation/moveByFileId.feature:493](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L493) -- [apiSpacesDavOperation/moveByFileId.feature:734](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L734) -- [apiSpacesDavOperation/moveByFileId.feature:735](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L735) +- [apiSpacesDavOperation/moveByFileId.feature:732](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L732) +- [apiSpacesDavOperation/moveByFileId.feature:733](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L733) ### [MOVE a file into same folder with same name returns 404 instead of 403](https://github.com/owncloud/ocis/issues/1976) diff --git a/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature b/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature index 99ad33668..03b5e35cc 100644 --- a/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature +++ b/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature @@ -491,8 +491,6 @@ Feature: moving/renaming file using file id | permissions | dav-path | | Editor | /remote.php/dav/spaces/<> | | Editor | /dav/spaces/<> | - | Viewer | /remote.php/dav/spaces/<> | - | Viewer | /dav/spaces/<> | Scenario Outline: try to move a file into a folder within a shared folder (read permissions) diff --git a/tests/acceptance/features/apiSpacesShares/moveSpaces.feature b/tests/acceptance/features/apiSpacesShares/moveSpaces.feature index d6e2ca5c1..4336e9db5 100644 --- a/tests/acceptance/features/apiSpacesShares/moveSpaces.feature +++ b/tests/acceptance/features/apiSpacesShares/moveSpaces.feature @@ -200,7 +200,7 @@ Feature: move (rename) file And for user "Alice" the space "Personal" should contain these entries: | personal.txt | But for user "Alice" folder "testshare" of the space "Shares" should not contain these entries: - | project.txt | + | personal.txt | Examples: | permissions-role | | Editor | From 62c024bc667b7ebb1b568b45cc6745f39806ae8e Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 5 Aug 2024 12:25:55 +0545 Subject: [PATCH 2/3] test: fix custom properties tests --- tests/TestHelpers/WebDavHelper.php | 68 +++++++++++-------- .../expected-failures-API-on-OCIS-storage.md | 9 --- .../bootstrap/WebDavPropertiesContext.php | 66 ++++++++---------- .../getFileProperties.feature | 18 ++--- 4 files changed, 75 insertions(+), 86 deletions(-) diff --git a/tests/TestHelpers/WebDavHelper.php b/tests/TestHelpers/WebDavHelper.php index 55064e7fb..56d15d92b 100644 --- a/tests/TestHelpers/WebDavHelper.php +++ b/tests/TestHelpers/WebDavHelper.php @@ -63,6 +63,18 @@ class WebDavHelper { } } + /** + * @param string $namespaceString + * + * @return object + */ + public static function parseNamespace(string $namespaceString): object { + //calculate the namespace prefix and namespace + $matches = []; + \preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches); + return (object)["namespace" => $matches[2], "prefix" => $matches[1]]; + } + /** * returns the id of a file * @@ -132,12 +144,9 @@ class WebDavHelper { //also used if no prefix is given in the property value $namespacePrefix = null; } else { - //calculate the namespace prefix and namespace from the array key - $matches = []; - \preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches); - $nameSpace = $matches[2]; - $namespacePrefix = $matches[1]; - $extraNamespaces .= " xmlns:$namespacePrefix=\"$nameSpace\" "; + $ns = self::parseNamespace($namespaceString); + $namespacePrefix = $ns->prefix; + $extraNamespaces .= " xmlns:$namespacePrefix=\"$ns->namespace\" "; } //if a namespace prefix is given in the property value use that if (\strpos($property, ":") !== false) { @@ -263,14 +272,11 @@ class WebDavHelper { ?string $type="files" ):ResponseInterface { if ($namespaceString !== null) { - $matches = []; - \preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches); - $namespace = $matches[2]; - $namespacePrefix = $matches[1]; - $propertyBody = "<$namespacePrefix:$propertyName" . - " xmlns:$namespacePrefix=\"$namespace\">" . + $ns = self::parseNamespace($namespaceString); + $propertyBody = "<$ns->prefix:$propertyName" . + " xmlns:$ns->prefix=\"$ns->namespace\">" . "$propertyValue" . - ""; + "prefix:$propertyName>"; } else { $propertyBody = "<$propertyName>$propertyValue"; } @@ -299,12 +305,12 @@ class WebDavHelper { * gets namespace-prefix, namespace url and propName from provided namespaceString or property * or otherwise use default * - * @param string|null $namespaceString - * @param string|null $property + * @param string $namespaceString + * @param string $property * * @return array */ - public static function getPropertyWithNamespaceInfo(?string $namespaceString = "", ?string $property = ""):array { + public static function getPropertyWithNamespaceInfo(string $namespaceString = "", string $property = ""):array { $namespace = ""; $namespacePrefix = ""; if (\is_int($namespaceString)) { @@ -313,11 +319,9 @@ class WebDavHelper { $namespacePrefix = "d"; $namespace = "DAV:"; } elseif ($namespaceString) { - //calculate the namespace prefix and namespace from the array key - $matches = []; - \preg_match("/^(.*)='(.*)'$/", $namespaceString, $matches); - $namespacePrefix = $matches[1]; - $namespace = $matches[2]; + $ns = self::parseNamespace($namespaceString); + $namespacePrefix = $ns->prefix; + $namespace = $ns->namespace; } //if a namespace prefix is given in the property value use that if ($property && \strpos($property, ":")) { @@ -352,20 +356,26 @@ class WebDavHelper { ?array $propertiesArray, ?string $xRequestId = '', ?int $davPathVersion = null, - ?string $namespaceString = "oc='http://owncloud.org/ns'", + ?string $namespaceString = null, ?string $type="files" ):ResponseInterface { $propertyBody = ""; foreach ($propertiesArray as $propertyArray) { $property = $propertyArray["propertyName"]; $value = $propertyArray["propertyValue"]; - [$namespacePrefix, $namespace, $property] = self::getPropertyWithNamespaceInfo( - $namespaceString, - $property - ); - $propertyBody .= "\n\t<$namespacePrefix:$property>" . - "$value" . - ""; + + if ($namespaceString !== null) { + $matches = []; + [$namespacePrefix, $namespace, $property] = self::getPropertyWithNamespaceInfo( + $namespaceString, + $property + ); + $propertyBody .= "\n\t<$namespacePrefix:$property>" . + "$value" . + ""; + } else { + $propertyBody .= "<$property>$value"; + } } $body = " $matches[2], "prefix" => $matches[1]]; - } - /** * @When /^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" using the WebDAV API$/ * @@ -165,10 +153,7 @@ class WebDavPropertiesContext implements Context { } /** - * @Given /^user "([^"]*)" has set the following properties of (?:file|folder|entry) "([^"]*)" using the WebDav API$/ - * - * if no namespace prefix is provided before property, default `oc:` prefix is set for added props - * only and everything rest on xml is set to prefix `d:` + * @Given /^user "([^"]*)" has set the following properties to (?:file|folder|entry) "([^"]*)" using the WebDav API$/ * * @param string $username * @param string $path @@ -490,7 +475,7 @@ class WebDavPropertiesContext implements Context { $this->featureContext->getResponse(), __METHOD__ ); - $ns = $this->parseNamespace($namespaceString); + $ns = WebDavHelper::parseNamespace($namespaceString); $responseXmlObject->registerXPathNamespace( $ns->prefix, $ns->namespace @@ -646,7 +631,7 @@ class WebDavPropertiesContext implements Context { $xmlPart = $this->featureContext->getResponseXml($response); if ($namespaceString !== null) { - $ns = $this->parseNamespace($namespaceString); + $ns = WebDavHelper::parseNamespace($namespaceString); $xmlPart->registerXPathNamespace( $ns->prefix, $ns->namespace @@ -1264,6 +1249,23 @@ class WebDavPropertiesContext implements Context { ); } + /** + * @param string $href + * + * @return string + */ + public function parseBaseDavPathFromXMLHref(string $href): string { + $hrefArr = \explode('/', $href); + if (\in_array("webdav", $hrefArr)) { + $hrefArr = \array_slice($hrefArr, 0, \array_search("webdav", $hrefArr) + 1); + } elseif (\in_array("files", $hrefArr)) { + $hrefArr = \array_slice($hrefArr, 0, \array_search("files", $hrefArr) + 2); + } elseif (\in_array("spaces", $hrefArr)) { + $hrefArr = \array_slice($hrefArr, 0, \array_search("spaces", $hrefArr) + 2); + } + return \implode('/', $hrefArr); + } + /** * @Then as user :username the last response should have the following properties * @@ -1283,28 +1285,14 @@ class WebDavPropertiesContext implements Context { $this->featureContext->verifyTableNodeColumns($expectedPropTable, ['resource', 'propertyName', 'propertyValue']); $responseXmlObject = $this->featureContext->getResponseXml(); - $hrefSplitUptoUsername = \explode("/", (string)$responseXmlObject->xpath("//d:href")[0]); - $xmlHrefSplitArray = \array_slice( - $hrefSplitUptoUsername, - 0, - \array_search($username, $hrefSplitUptoUsername) + 1 - ); - $xmlHref = \implode("/", $xmlHrefSplitArray); + $href = (string)$responseXmlObject->xpath("//d:href")[0]; + $hrefBase = $this->parseBaseDavPathFromXMLHref($href); + foreach ($expectedPropTable->getColumnsHash() as $col) { - if ($col["propertyName"] === "status") { - $xmlPart = $responseXmlObject->xpath( - "//d:href[.='" . - $xmlHref . $col["resource"] . - "']/following-sibling::d:propstat//d:" . - $col["propertyName"] - ); - } else { - $xmlPart = $responseXmlObject->xpath( - "//d:href[.= '" . - $xmlHref . $col["resource"] . - "']/..//oc:" . $col["propertyName"] - ); - } + $xpath = "//d:href[.='$hrefBase" . $col["resource"] . "']" . + "/following-sibling::d:propstat//" . $col["propertyName"]; + $xmlPart = $responseXmlObject->xpath($xpath); + Assert::assertEquals( $col["propertyValue"], $xmlPart[0], diff --git a/tests/acceptance/features/coreApiWebdavProperties/getFileProperties.feature b/tests/acceptance/features/coreApiWebdavProperties/getFileProperties.feature index 22766e1ec..24680b033 100644 --- a/tests/acceptance/features/coreApiWebdavProperties/getFileProperties.feature +++ b/tests/acceptance/features/coreApiWebdavProperties/getFileProperties.feature @@ -297,20 +297,20 @@ Feature: get file properties Given using DAV path And user "Alice" has created folder "/TestFolder" And user "Alice" has uploaded file with content "test data one" to "/TestFolder/test1.txt" - And user "Alice" has set the following properties of file "/TestFolder/test1.txt" using the WebDav API + And user "Alice" has set the following properties to file "/TestFolder/test1.txt" using the WebDav API | propertyName | propertyValue | | testprop1 | AAAAA | | testprop2 | BBBBB | When user "Alice" gets the following properties of file "/TestFolder/test1.txt" using the WebDAV API | propertyName | - | oc:testprop1 | - | oc:testprop2 | + | testprop1 | + | testprop2 | Then the HTTP status code should be "207" And as user "Alice" the last response should have the following properties | resource | propertyName | propertyValue | | /TestFolder/test1.txt | testprop1 | AAAAA | | /TestFolder/test1.txt | testprop2 | BBBBB | - | /TestFolder/test1.txt | status | HTTP/1.1 200 OK | + | /TestFolder/test1.txt | d:status | HTTP/1.1 200 OK | Examples: | dav-path-version | | new | @@ -323,18 +323,18 @@ Feature: get file properties And user "Alice" has created folder "/TestFolder" And user "Alice" has uploaded file with content "test data one" to "/TestFolder/test1.txt" And user "Alice" has uploaded file with content "test data two" to "/TestFolder/test2.txt" - And user "Alice" has set the following properties of file "/TestFolder/test1.txt" using the WebDav API + And user "Alice" has set the following properties to file "/TestFolder/test1.txt" using the WebDav API | propertyName | propertyValue | | testprop1 | AAAAA | | testprop2 | BBBBB | - And user "Alice" has set the following properties of file "/TestFolder/test2.txt" using the WebDav API + And user "Alice" has set the following properties to file "/TestFolder/test2.txt" using the WebDav API | propertyName | propertyValue | | testprop1 | CCCCC | | testprop2 | DDDDD | When user "Alice" gets the following properties of folder "/TestFolder" using the WebDAV API | propertyName | - | oc:testprop1 | - | oc:testprop2 | + | testprop1 | + | testprop2 | Then the HTTP status code should be "207" And as user "Alice" the last response should have the following properties | resource | propertyName | propertyValue | @@ -342,7 +342,7 @@ Feature: get file properties | /TestFolder/test1.txt | testprop2 | BBBBB | | /TestFolder/test2.txt | testprop1 | CCCCC | | /TestFolder/test2.txt | testprop2 | DDDDD | - | /TestFolder/ | status | HTTP/1.1 404 Not Found | + | /TestFolder/ | d:status | HTTP/1.1 404 Not Found | Examples: | dav-path-version | | new | From 558bbcc6aefa894ff60b3b6899570586c97bdee3 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 5 Aug 2024 14:46:40 +0545 Subject: [PATCH 3/3] test: fix COPY tests --- .../expected-failures-API-on-OCIS-storage.md | 16 ++-- ...ected-failures-localAPI-on-OCIS-storage.md | 2 + .../copyFromPublicLink.feature | 74 ++++++++++++------- .../coreApiWebdavProperties/copyFile.feature | 28 +++++++ 4 files changed, 83 insertions(+), 37 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 81709131e..ebb2bfdb0 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -49,15 +49,6 @@ Synchronization features like etag propagation, setting mtime and locking files ### Share -#### [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) - -- [coreApiSharePublicLink2/copyFromPublicLink.feature:75](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L75) -- [coreApiSharePublicLink2/copyFromPublicLink.feature:105](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L105) -- [coreApiSharePublicLink2/copyFromPublicLink.feature:199](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L199) -- [coreApiSharePublicLink2/copyFromPublicLink.feature:200](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L200) -- [coreApiSharePublicLink2/copyFromPublicLink.feature:217](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L217) -- [coreApiSharePublicLink2/copyFromPublicLink.feature:218](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L218) - #### [d:quota-available-bytes in dprop of PROPFIND give wrong response value](https://github.com/owncloud/ocis/issues/8197) - [coreApiWebdavProperties/getQuota.feature:57](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/getQuota.feature#L57) @@ -239,5 +230,12 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [coreApiWebdavMove2/moveShareOnOcis.feature:307](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveShareOnOcis.feature#L307) - [coreApiWebdavMove2/moveShareOnOcis.feature:310](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveShareOnOcis.feature#L310) +### [COPY file/folder to same name is possible (but 500 code error for folder with spaces path)](https://github.com/owncloud/ocis/issues/8711) + +- [coreApiSharePublicLink2/copyFromPublicLink.feature:198](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature#L198) +- [coreApiWebdavProperties/copyFile.feature:979](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L979) +- [coreApiWebdavProperties/copyFile.feature:980](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L980) +- [coreApiWebdavProperties/copyFile.feature:981](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L981) + Note: always have an empty line at the end of this file. The bash script that processes this file requires that the last line has a newline on the end. diff --git a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md index 6e7546c92..b91ab38d3 100644 --- a/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-localAPI-on-OCIS-storage.md @@ -282,6 +282,8 @@ The expected failures in this file are from features in the owncloud/ocis repo. - [apiSpacesDavOperation/moveByFileId.feature:207](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L207) - [apiSpacesDavOperation/moveByFileId.feature:208](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L208) - [apiSpacesDavOperation/moveByFileId.feature:209](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L209) +- [apiSpacesDavOperation/moveByFileId.feature:492](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L492) +- [apiSpacesDavOperation/moveByFileId.feature:493](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/apiSpacesDavOperation/moveByFileId.feature#L493) ### [OCM. sharing issues](https://github.com/owncloud/ocis/issues/9534) diff --git a/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature b/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature index 1f39d8e5d..40000d809 100644 --- a/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature +++ b/tests/acceptance/features/coreApiSharePublicLink2/copyFromPublicLink.feature @@ -57,7 +57,7 @@ Feature: copying from public link share And the content of file "/PARENT/testFolder/copy1.txt" for user "Alice" should be "some data" - Scenario: copy file within a public link folder to same file name as already existing one + Scenario: copy file within a public link folder to existing file Given user "Alice" has uploaded file with content "some data 0" to "/PARENT/testfile.txt" And user "Alice" has uploaded file with content "some data 1" to "/PARENT/copy1.txt" And using SharingNG @@ -72,7 +72,7 @@ Feature: copying from public link share And the content of file "/PARENT/copy1.txt" for user "Alice" should be "some data 0" @issue-1232 - Scenario: copy folder within a public link folder to the same folder name as an already existing file + Scenario: copy folder within a public link folder to existing file Given user "Alice" has created folder "/PARENT/testFolder" And user "Alice" has uploaded file with content "some data" to "/PARENT/testFolder/testfile.txt" And user "Alice" has uploaded file with content "some data 1" to "/PARENT/copy1.txt" @@ -82,11 +82,11 @@ Feature: copying from public link share | space | Personal | | permissionsRole | edit | When the public copies folder "/testFolder" to "/copy1.txt" using the new public WebDAV API - Then the HTTP status code should be "403" + Then the HTTP status code should be "204" And as "Alice" folder "/PARENT/testFolder" should exist - And as "Alice" folder "/PARENT/copy1.txt" should exist - And as "Alice" file "/PARENT/copy1.txt/testfile.txt" should not exist - And the content of file "/PARENT/testFolder/testfile.txt" for user "Alice" should be "some data" + And the content of file "/PARENT/copy1.txt/testfile.txt" for user "Alice" should be "some data" + But as "Alice" file "/PARENT/copy1.txt" should not exist + And as "Alice" file "/copy1.txt" should exist in the trashbin Scenario: copy file within a public link folder and delete file @@ -102,7 +102,7 @@ Feature: copying from public link share And as "Alice" file "/PARENT/copy1.txt" should not exist @issue-1232 - Scenario: copy file within a public link folder to a file with name same as an existing folder + Scenario: copy file within a public link folder to existing folder Given user "Alice" has uploaded file with content "some data" to "/PARENT/testfile.txt" And user "Alice" has created folder "/PARENT/new-folder" And user "Alice" has uploaded file with content "some data 1" to "/PARENT/new-folder/testfile1.txt" @@ -112,11 +112,11 @@ Feature: copying from public link share | space | Personal | | permissionsRole | edit | When the public copies file "/testfile.txt" to "/new-folder" using the new public WebDAV API - Then the HTTP status code should be "403" - And as "Alice" file "/PARENT/testfile.txt" should exist - And as "Alice" folder "/PARENT/new-folder" should exist + Then the HTTP status code should be "204" And the content of file "/PARENT/testfile.txt" for user "Alice" should be "some data" - And the content of file "/PARENT/new-folder/testfile.txt" for user "Alice" should be "some data" + And the content of file "/PARENT/new-folder" for user "Alice" should be "some data" + And as "Alice" folder "/PARENT/new-folder" should not exist + And as "Alice" folder "new-folder" should exist in the trashbin Scenario Outline: copy file with special characters in it's name within a public link folder @@ -182,25 +182,20 @@ Feature: copying from public link share | C++ file.cpp | | sample,1.txt | - @issue-1230 - Scenario Outline: copy file within a public link folder to a file with unusual destination names + @issue-8711 + Scenario: copy file within a public link folder to a same file Given user "Alice" has uploaded file with content "some data" to "/PARENT/testfile.txt" And using SharingNG And user "Alice" has created the following resource link share: | resource | PARENT | | space | Personal | | permissionsRole | edit | - When the public copies file "/testfile.txt" to "/" using the new public WebDAV API - Then the HTTP status code should be "403" - And as "Alice" file "/PARENT/testfile.txt" should exist + When the public copies file "/testfile.txt" to "/testfile.txt" using the new public WebDAV API + Then the HTTP status code should be "204" And the content of file "/PARENT/testfile.txt" for user "Alice" should be "some data" - Examples: - | destination-file-name | - | testfile.txt | - | | - @issue-1230 - Scenario Outline: copy folder within a public link folder to a folder with unusual destination names + @issue-8711 + Scenario: copy folder within a public link folder to a same folder Given user "Alice" has created folder "/PARENT/testFolder" And user "Alice" has uploaded file with content "some data" to "/PARENT/testFolder/testfile.txt" And using SharingNG @@ -208,11 +203,34 @@ Feature: copying from public link share | resource | PARENT | | space | Personal | | permissionsRole | edit | - When the public copies folder "/testFolder" to "/" using the new public WebDAV API - Then the HTTP status code should be "403" + When the public copies folder "/testFolder" to "/testFolder" using the new public WebDAV API + Then the HTTP status code should be "204" + And as "Alice" folder "/PARENT/testFolder" should exist + And the content of file "/PARENT/testFolder/testfile.txt" for user "Alice" should be "some data" + + @issue-1230 + Scenario: copy file within a public link folder to a share item root + Given user "Alice" has uploaded file with content "some data" to "/PARENT/testfile.txt" + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | PARENT | + | space | Personal | + | permissionsRole | edit | + When the public copies file "/testfile.txt" to "/" using the new public WebDAV API + Then the HTTP status code should be "409" + And as "Alice" file "/PARENT/testfile.txt" should exist + And the content of file "/PARENT/testfile.txt" for user "Alice" should be "some data" + + @issue-1230 + Scenario: copy folder within a public link folder to a share item root + Given user "Alice" has created folder "/PARENT/testFolder" + And user "Alice" has uploaded file with content "some data" to "/PARENT/testFolder/testfile.txt" + And using SharingNG + And user "Alice" has created the following resource link share: + | resource | PARENT | + | space | Personal | + | permissionsRole | edit | + When the public copies folder "/testFolder" to "/" using the new public WebDAV API + Then the HTTP status code should be "409" And as "Alice" folder "/PARENT/testFolder" should exist And the content of file "/PARENT/testFolder/testfile.txt" for user "Alice" should be "some data" - Examples: - | destination-file-name | - | testFolder | - | | diff --git a/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature b/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature index e4b6010eb..61c9ca14a 100644 --- a/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature +++ b/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature @@ -951,3 +951,31 @@ Feature: copy file | spaces | "'single'" | "folder-'single'" | "folder-'single'/'single'" | | spaces | "question?" | "folder-question?" | "folder-question?/question?" | | spaces | "&and#hash" | "folder-&and#hash" | "folder-&and#hash/&and#hash" | + + @issue-8711 + Scenario Outline: copying a file to itself + Given using DAV path + And user "Alice" has uploaded file with content "lorem epsum" to "textfile.txt" + When user "Alice" copies file "textfile.txt" to "textfile.txt" using the WebDAV API + Then the HTTP status code should be "204" + And the content of file "textfile.txt" for user "Alice" should be "lorem epsum" + Examples: + | dav-path-version | + | old | + | new | + | spaces | + + @issue-8711 + Scenario Outline: copying a folder to itself + Given using DAV path + And user "Alice" has created folder "FOLDER1" + And user "Alice" has uploaded file with content "Folder 1 text" to "FOLDER1/textfile.txt" + When user "Alice" copies folder "FOLDER1" to "FOLDER1" using the WebDAV API + Then the HTTP status code should be "204" + And as "Alice" folder "FOLDER1" should exist + And the content of file "FOLDER1/textfile.txt" for user "Alice" should be "lorem epsum" + Examples: + | dav-path-version | + | old | + | new | + | spaces |