From f5edb57d33777da8ecb064ccd07aaa2948238b3f Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 12 Aug 2024 18:14:37 +0545 Subject: [PATCH] test: fix tests and issue number --- .../expected-failures-API-on-OCIS-storage.md | 17 +---------------- tests/acceptance/features/bootstrap/WebDav.php | 5 +++++ .../coreApiWebdavMove1/moveFolder.feature | 6 +++--- .../coreApiWebdavMove2/moveFile.feature | 13 +++++-------- .../coreApiWebdavProperties/copyFile.feature | 10 +++------- .../createFileFolder.feature | 10 +++------- .../coreApiWebdavUpload/uploadFile.feature | 9 +++------ 7 files changed, 23 insertions(+), 47 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index c8fde7a56d..94140d12c6 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -164,27 +164,12 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - _The `OC-LazyOps` header is [no longer supported by the client](https://github.com/owncloud/client/pull/8398), implementing this is not necessary for a first production release. We plan to have an upload state machine to visualize the state of a file, see https://github.com/owncloud/ocis/issues/214_ - _Blacklisted ignored files are no longer required because ocis can handle `.htaccess` files without security implications introduced by serving user provided files with apache._ -#### [Blacklist files extensions](https://github.com/owncloud/ocis/issues/2177) - -- [coreApiWebdavProperties/copyFile.feature:109](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L109) -- [coreApiWebdavProperties/copyFile.feature:110](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L110) -- [coreApiWebdavProperties/copyFile.feature:111](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L111) -- [coreApiWebdavProperties/createFileFolder.feature:95](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L95) -- [coreApiWebdavProperties/createFileFolder.feature:96](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L96) -- [coreApiWebdavProperties/createFileFolder.feature:97](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature#L97) -- [coreApiWebdavUpload/uploadFile.feature:153](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L153) -- [coreApiWebdavUpload/uploadFile.feature:152](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L152) -- [coreApiWebdavUpload/uploadFile.feature:154](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature#L154) -- [coreApiWebdavMove2/moveFile.feature:177](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L177) -- [coreApiWebdavMove2/moveFile.feature:178](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L178) -- [coreApiWebdavMove2/moveFile.feature:143](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L143) - #### [Renaming resource to banned name is allowed in spaces webdav](https://github.com/owncloud/ocis/issues/3099) +- [coreApiWebdavMove2/moveFile.feature:143](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L143) - [coreApiWebdavMove1/moveFolder.feature:36](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L36) - [coreApiWebdavMove1/moveFolder.feature:50](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L50) - [coreApiWebdavMove1/moveFolder.feature:64](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature#L64) -- [coreApiWebdavMove2/moveFile.feature:179](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature#L179) #### [HTTP status code differ while deleting file of another user's trash bin](https://github.com/owncloud/ocis/issues/3544) diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index d7241be09d..be822278bf 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -1652,10 +1652,15 @@ trait WebDav { $elementToRequest, "1" ); + + // TODO: make it work for folder entries + // Doesn't work for folder entries + // as the folder entry has trailing '/' in d:href $webdavPath = "/" . $this->getFullDavFilesPath($user) . $expectedElement; $element = $responseXmlObject->xpath( "//d:response/d:href[text() = \"$webdavPath\"]" ); + if ($expectedToBeListed && (!isset($element[0]) || urldecode($element[0]->__toString()) !== urldecode($webdavPath)) ) { diff --git a/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature b/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature index 9124f89706..7c2236ee9a 100644 --- a/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature +++ b/tests/acceptance/features/coreApiWebdavMove1/moveFolder.feature @@ -21,7 +21,7 @@ Feature: move (rename) folder | new | | spaces | - + @issue-3099 Scenario Outline: renaming a folder to a backslash should return an error Given using DAV path And user "Alice" has created folder "/testshare" @@ -35,7 +35,7 @@ Feature: move (rename) folder | new | | spaces | - + @issue-3099 Scenario Outline: renaming a folder beginning with a backslash should return an error Given using DAV path And user "Alice" has created folder "/testshare" @@ -49,7 +49,7 @@ Feature: move (rename) folder | new | | spaces | - + @issue-3099 Scenario Outline: renaming a folder including a backslash encoded should return an error Given using DAV path And user "Alice" has created folder "/testshare" diff --git a/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature b/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature index 1f7cbdb0e6..a35caac076 100644 --- a/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature +++ b/tests/acceptance/features/coreApiWebdavMove2/moveFile.feature @@ -130,7 +130,7 @@ Feature: move (rename) file | new | | spaces | - @issue-1295 + @issue-1295 @issue-2177 @issue-3099 Scenario Outline: rename a file into an invalid filename Given using DAV path And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "fileToRename.txt" @@ -159,19 +159,16 @@ Feature: move (rename) file | new | | spaces | - @issue-1295 + @issue-1295 @issue-2177 Scenario Outline: renaming a file to a path with extension .part should not be possible Given using DAV path And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "fileToRename.txt" When user "Alice" moves file "/fileToRename.txt" to "/welcome.part" using the WebDAV API - Then the HTTP status code should be "400" - And the DAV exception should be "OCA\DAV\Connector\Sabre\Exception\InvalidPath" - And the DAV message should be "Can`t upload files with extension .part because these extensions are reserved for internal use." - And the DAV reason should be "Can`t upload files with extension .part because these extensions are reserved for internal use." + Then the HTTP status code should be "201" And user "Alice" should see the following elements - | /fileToRename.txt | + | /welcome.part | But user "Alice" should not see the following elements - | /fileToRename.part | + | /fileToRename.txt | Examples: | dav-path-version | | old | diff --git a/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature b/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature index 2ba1ac2a5c..3c6eda5c98 100644 --- a/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature +++ b/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature @@ -92,18 +92,14 @@ Feature: copy file | old | | new | - @issue-1345 + @issue-1345 @issue-2177 Scenario Outline: copying file to a path with extension .part should not be possible Given using DAV path When user "Alice" copies file "/textfile1.txt" to "/textfile1.part" using the WebDAV API - Then the HTTP status code should be "400" - And the DAV exception should be "OCA\DAV\Connector\Sabre\Exception\InvalidPath" - And the DAV message should be "Can`t upload files with extension .part because these extensions are reserved for internal use." - And the DAV reason should be "Can`t upload files with extension .part because these extensions are reserved for internal use." + Then the HTTP status code should be "201" And user "Alice" should see the following elements - | /textfile1.txt | - But user "Alice" should not see the following elements | /textfile1.part | + | /textfile1.txt | Examples: | dav-path-version | | old | diff --git a/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature b/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature index dedcdcb619..68d6c3ab24 100644 --- a/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature +++ b/tests/acceptance/features/coreApiWebdavProperties/createFileFolder.feature @@ -80,16 +80,12 @@ Feature: create files and folder | new | | spaces | - @issue-1345 + @issue-1345 @issue-2177 Scenario Outline: creating a directory which contains .part should not be possible Given using DAV path When user "Alice" creates folder "/folder.with.ext.part" using the WebDAV API - Then the HTTP status code should be "400" - And the DAV exception should be "OCA\DAV\Connector\Sabre\Exception\InvalidPath" - And the DAV message should be "Can`t upload files with extension .part because these extensions are reserved for internal use." - And the DAV reason should be "Can`t upload files with extension .part because these extensions are reserved for internal use." - And user "Alice" should not see the following elements - | /folder.with.ext.part | + Then the HTTP status code should be "201" + And as "Alice" folder "folder.with.ext.part" should exist Examples: | dav-path-version | | old | diff --git a/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature b/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature index 3237acaba9..82636c4260 100644 --- a/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature +++ b/tests/acceptance/features/coreApiWebdavUpload/uploadFile.feature @@ -137,15 +137,12 @@ Feature: upload file | new | | spaces | - @issue-1345 + @issue-1345 @issue-2177 Scenario Outline: uploading file to path with extension .part should not be possible Given using DAV path When user "Alice" uploads file "filesForUpload/textfile.txt" to "/textfile.part" using the WebDAV API - Then the HTTP status code should be "400" - And the DAV exception should be "OCA\DAV\Connector\Sabre\Exception\InvalidPath" - And the DAV message should be "Can`t upload files with extension .part because these extensions are reserved for internal use." - And the DAV reason should be "Can`t upload files with extension .part because these extensions are reserved for internal use." - And user "Alice" should not see the following elements + Then the HTTP status code should be "201" + And user "Alice" should see the following elements | /textfile.part | Examples: | dav-path-version |