From 1784577fe79ff3fcce4a735f5f1b2da6b1e02b41 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 12 Aug 2024 17:43:46 +0545 Subject: [PATCH 1/4] test: fix issue numbers --- .../expected-failures-API-on-OCIS-storage.md | 21 +++++-------------- .../features/bootstrap/FavoritesContext.php | 2 +- .../coreApiAuth/webDavLOCKAuth.feature | 4 ++-- .../coreApiAuth/webDavPUTAuth.feature | 8 +++---- .../coreApiFavorites/favorites.feature | 18 ++++++++-------- .../favoritesSharingToShares.feature | 2 +- .../features/coreApiMain/checksums.feature | 2 +- .../trashbinSharingToShares.feature | 4 ++-- .../refuseAccess.feature | 4 ++-- .../coreApiWebdavOperations/search.feature | 4 ++-- 10 files changed, 29 insertions(+), 40 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index a4258733e9b..c8fde7a56d9 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -70,7 +70,7 @@ _ocdav: api compatibility, return correct status code_ - [coreApiAuth/webDavMKCOLAuth.feature:42](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavMKCOLAuth.feature#L42) - [coreApiAuth/webDavMKCOLAuth.feature:53](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavMKCOLAuth.feature#L53) -#### [trying to lock file of another user gives http 200](https://github.com/owncloud/ocis/issues/2176) +#### [trying to lock file of another user gives http 500](https://github.com/owncloud/ocis/issues/2176) - [coreApiAuth/webDavLOCKAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature#L46) - [coreApiAuth/webDavLOCKAuth.feature:58](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature#L58) @@ -82,12 +82,7 @@ _ocdav: api compatibility, return correct status code_ - [coreApiAuth/webDavPOSTAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature#L46) - [coreApiAuth/webDavPOSTAuth.feature:55](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature#L55) -#### Another users space literally does not exist because it is not listed as a space for him, 404 seems correct, expects 403 - -- [coreApiAuth/webDavPUTAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature#L46) -- [coreApiAuth/webDavPUTAuth.feature:58](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature#L58) - -#### [[old/new/spaces] In ocis and oc10, REPORT request response differently](https://github.com/owncloud/ocis/issues/4712) +#### [Missing properties in REPORT response](https://github.com/owncloud/ocis/issues/9780), [REPORT response has different date format for d:getlastmodified](https://github.com/owncloud/ocis/issues/9781), [d:getetag property has empty value in REPORT response](https://github.com/owncloud/ocis/issues/9783) - [coreApiWebdavOperations/search.feature:180](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/search.feature#L180) - [coreApiWebdavOperations/search.feature:181](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/search.feature#L181) @@ -100,13 +95,13 @@ _ocdav: api compatibility, return correct status code_ - [coreApiFavorites/favorites.feature:101](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L101) - [coreApiFavorites/favorites.feature:102](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L102) +- [coreApiFavorites/favorites.feature:103](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L103) - [coreApiFavorites/favorites.feature:124](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L124) - [coreApiFavorites/favorites.feature:125](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L125) +- [coreApiFavorites/favorites.feature:126](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L126) - [coreApiFavorites/favorites.feature:189](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L189) - [coreApiFavorites/favorites.feature:190](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L190) - -And other missing implementation of favorites - +- [coreApiFavorites/favorites.feature:191](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L191) - [coreApiFavorites/favorites.feature:145](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L145) - [coreApiFavorites/favorites.feature:146](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L146) - [coreApiFavorites/favorites.feature:147](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L147) @@ -191,12 +186,6 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [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) -#### [REPORT method on spaces returns an incorrect d:href response](https://github.com/owncloud/ocis/issues/3111) - -- [coreApiFavorites/favorites.feature:103](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L103) -- [coreApiFavorites/favorites.feature:126](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L126) -- [coreApiFavorites/favorites.feature:191](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiFavorites/favorites.feature#L191) - #### [HTTP status code differ while deleting file of another user's trash bin](https://github.com/owncloud/ocis/issues/3544) - [coreApiTrashbin/trashbinDelete.feature:92](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature#L92) diff --git a/tests/acceptance/features/bootstrap/FavoritesContext.php b/tests/acceptance/features/bootstrap/FavoritesContext.php index 0cf927acb54..b9117033e09 100644 --- a/tests/acceptance/features/bootstrap/FavoritesContext.php +++ b/tests/acceptance/features/bootstrap/FavoritesContext.php @@ -100,7 +100,7 @@ public function userUnfavoritesElementUsingWebDavApi(string $user, string $path) } /** - * @Then /^user "([^"]*)" should (not|)\s?have favorited the following elements$/ + * @Then /^user "([^"]*)" should (not|)\s?have the following favorited items$/ * * @param string $user * @param string $shouldOrNot (not|) diff --git a/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature b/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature index 4bccd7afbf8..d47099be9cd 100644 --- a/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature +++ b/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature @@ -42,7 +42,7 @@ Feature: LOCK file/folder | /remote.php/dav/spaces/%spaceid%/PARENT/parent.txt | Then the HTTP status code of responses on all endpoints should be "401" - @issue-1347 + @issue-1347 @issue-2176 Scenario: send LOCK requests to another user's webDav endpoints as normal user When user "Brian" requests these endpoints with "LOCK" to get property "d:shared" about user "Alice" | endpoint | @@ -54,7 +54,7 @@ Feature: LOCK file/folder | /remote.php/dav/files/%username%/PARENT/parent.txt | Then the HTTP status code of responses on all endpoints should be "409" - @issue-1347 + @issue-1347 @issue-2176 Scenario: send LOCK requests to another user's webDav endpoints as normal user using the spaces WebDAV API When user "Brian" requests these endpoints with "LOCK" to get property "d:shared" about user "Alice" | endpoint | diff --git a/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature b/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature index 5d73ae65853..5e2967abddc 100644 --- a/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature +++ b/tests/acceptance/features/coreApiAuth/webDavPUTAuth.feature @@ -48,11 +48,11 @@ Feature: PUT file/folder | endpoint | | /remote.php/dav/files/%username%/textfile1.txt | | /remote.php/dav/files/%username%/PARENT | - Then the HTTP status code of responses on all endpoints should be "403" + Then the HTTP status code of responses on all endpoints should be "404" When user "Brian" requests these endpoints with "PUT" including body "doesnotmatter" about user "Alice" | endpoint | | /remote.php/dav/files/%username%/PARENT/parent.txt | - Then the HTTP status code of responses on all endpoints should be "403" + Then the HTTP status code of responses on all endpoints should be "404" Scenario: send PUT requests to another user's webDav endpoints as normal user using the spaces WebDAV API @@ -60,11 +60,11 @@ Feature: PUT file/folder | endpoint | | /remote.php/dav/spaces/%spaceid%/textfile0.txt | | /remote.php/dav/spaces/%spaceid%/PARENT | - Then the HTTP status code of responses on all endpoints should be "403" + Then the HTTP status code of responses on all endpoints should be "404" When user "Brian" requests these endpoints with "PUT" including body "doesnotmatter" about user "Alice" | endpoint | | /remote.php/dav/spaces/%spaceid%/PARENT/parent.txt | - Then the HTTP status code of responses on all endpoints should be "403" + Then the HTTP status code of responses on all endpoints should be "404" Scenario: send PUT requests to webDav endpoints using invalid username but correct password diff --git a/tests/acceptance/features/coreApiFavorites/favorites.feature b/tests/acceptance/features/coreApiFavorites/favorites.feature index 4d02c48a0f7..342a74290e1 100644 --- a/tests/acceptance/features/coreApiFavorites/favorites.feature +++ b/tests/acceptance/features/coreApiFavorites/favorites.feature @@ -85,14 +85,14 @@ Feature: favorite | new | | spaces | - @smokeTest + @smokeTest @issue-1228 Scenario Outline: get favorited elements of a folder Given using DAV path When user "Alice" favorites element "/FOLDER" using the WebDAV API And user "Alice" favorites element "/textfile0.txt" using the WebDAV API And user "Alice" favorites element "/textfile1.txt" using the WebDAV API Then the HTTP status code should be "207" - And user "Alice" should have favorited the following elements + And user "Alice" should have the following favorited items | /FOLDER | | /textfile0.txt | | /textfile1.txt | @@ -102,7 +102,7 @@ Feature: favorite | new | | spaces | - + @issue-1228 Scenario Outline: get favorited elements of a subfolder Given using DAV path And user "Alice" has created folder "/subfolder" @@ -114,10 +114,10 @@ Feature: favorite And user "Alice" favorites element "/subfolder/textfile2.txt" using the WebDAV API And user "Alice" unfavorites element "/subfolder/textfile1.txt" using the WebDAV API Then the HTTP status code should be "207" - And user "Alice" should have favorited the following elements + And user "Alice" should have the following favorited items | /subfolder/textfile0.txt | | /subfolder/textfile2.txt | - And user "Alice" should not have favorited the following elements + And user "Alice" should not have the following favorited items | /subfolder/textfile1.txt | Examples: | dav-path-version | @@ -125,7 +125,7 @@ Feature: favorite | new | | spaces | - + @issue-1228 Scenario Outline: get favorited elements and limit count of entries Given using DAV path And user "Alice" has favorited element "/textfile0.txt" @@ -146,7 +146,7 @@ Feature: favorite | new | | spaces | - + @issue-1228 Scenario Outline: get favorited elements paginated in subfolder Given using DAV path And user "Alice" has created folder "/subfolder" @@ -175,13 +175,13 @@ Feature: favorite | new | | spaces | - + @issue-1228 Scenario Outline: favoriting a folder does not change the favorite state of elements inside the folder Given using DAV path When user "Alice" favorites element "/PARENT/parent.txt" using the WebDAV API And user "Alice" favorites element "/PARENT" using the WebDAV API Then the HTTP status code should be "207" - And user "Alice" should have favorited the following elements + And user "Alice" should have the following favorited items | /PARENT | | /PARENT/parent.txt | Examples: diff --git a/tests/acceptance/features/coreApiFavorites/favoritesSharingToShares.feature b/tests/acceptance/features/coreApiFavorites/favoritesSharingToShares.feature index 1fffc1572f7..8e64893be3b 100644 --- a/tests/acceptance/features/coreApiFavorites/favoritesSharingToShares.feature +++ b/tests/acceptance/features/coreApiFavorites/favoritesSharingToShares.feature @@ -67,7 +67,7 @@ Feature: favorite | old | | new | - + @issue-1228 Scenario Outline: moving a favorite file out of a share keeps favorite state Given using DAV path And user "Brian" has been created with default attributes and without skeleton files diff --git a/tests/acceptance/features/coreApiMain/checksums.feature b/tests/acceptance/features/coreApiMain/checksums.feature index 99b65dc55f3..7d07a5a6dba 100644 --- a/tests/acceptance/features/coreApiMain/checksums.feature +++ b/tests/acceptance/features/coreApiMain/checksums.feature @@ -207,7 +207,7 @@ Feature: checksums | spaces | ## Validation Plugin or Old Endpoint Specific - @issue-1343 + @issue-1343 @issue-2323 Scenario Outline: uploading an old method chunked file with checksum should fail using new DAV path Given using DAV path When user "Alice" uploads chunk file "1" of "3" with "AAAAA" to "/myChecksumFile.txt" with checksum "MD5:45a72715acdd5019c5be30bdbb75233e" using the WebDAV API diff --git a/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature b/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature index 916752959b8..a8c9b5d1f96 100644 --- a/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature +++ b/tests/acceptance/features/coreApiTrashbin/trashbinSharingToShares.feature @@ -30,8 +30,8 @@ Feature: using trashbin together with sharing | new | | spaces | - @issue-1224 @issue-7555 - Scenario Outline: deleting a file in a received folder moves it to trashbin of both users + @issue-1124 @issue-7555 + Scenario Outline: sharee deleting a file in a received folder after renaming the shared folder moves it to trashbin of both users Given using DAV path And user "Brian" has been created with default attributes and without skeleton files And user "Alice" has created folder "/shared" diff --git a/tests/acceptance/features/coreApiWebdavOperations/refuseAccess.feature b/tests/acceptance/features/coreApiWebdavOperations/refuseAccess.feature index 2f33e90295b..c2240c46564 100644 --- a/tests/acceptance/features/coreApiWebdavOperations/refuseAccess.feature +++ b/tests/acceptance/features/coreApiWebdavOperations/refuseAccess.feature @@ -6,7 +6,7 @@ Feature: refuse access Background: Given using OCS API version "1" - @smokeTest + @smokeTest @issue-2285 Scenario Outline: unauthenticated call # cannot perform with spaces WebDAV due to the absence of user Given using DAV path @@ -21,7 +21,7 @@ Feature: refuse access | old | | new | - + @issue-2285 Scenario Outline: disabled user cannot use webdav Given using DAV path And user "Alice" has been created with default attributes and without skeleton files diff --git a/tests/acceptance/features/coreApiWebdavOperations/search.feature b/tests/acceptance/features/coreApiWebdavOperations/search.feature index ca1fd9c6b13..dbfad65a4e9 100644 --- a/tests/acceptance/features/coreApiWebdavOperations/search.feature +++ b/tests/acceptance/features/coreApiWebdavOperations/search.feature @@ -152,7 +152,7 @@ Feature: Search | new | | spaces | - @issue-4712 + @issue-4712 @issue-9780 @issue-9781 @issue-9783 Scenario Outline: report extra properties in search entries for a file Given using DAV path When user "Alice" searches for "*upload*" using the WebDAV API requesting these properties: @@ -181,7 +181,7 @@ Feature: Search | new | | spaces | - @issue-4712 + @issue-4712 @issue-9780 @issue-9781 @issue-9783 Scenario Outline: report extra properties in search entries for a folder Given using DAV path When user "Alice" searches for "*upload*" using the WebDAV API requesting these properties: From f5edb57d33777da8ecb064ccd07aaa2948238b3f Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Mon, 12 Aug 2024 18:14:37 +0545 Subject: [PATCH 2/4] 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 c8fde7a56d9..94140d12c63 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 d7241be09d0..be822278bfd 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -1652,10 +1652,15 @@ public function checkElementList( $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 9124f89706f..7c2236ee9aa 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 1f7cbdb0e60..a35caac0764 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 2ba1ac2a5cb..3c6eda5c984 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 dedcdcb6199..68d6c3ab24f 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 3237acaba98..82636c4260c 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 | From 0bbbd761567fbfc308cad8b4c1387a45a6ebc1a5 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 13 Aug 2024 12:03:54 +0545 Subject: [PATCH 3/4] test: fix trashbin delete tests --- .../expected-failures-API-on-OCIS-storage.md | 9 +- .../features/bootstrap/TrashbinContext.php | 132 +++++++----------- .../coreApiAuth/webDavPOSTAuth.feature | 4 +- .../coreApiTrashbin/trashbinDelete.feature | 2 +- 4 files changed, 56 insertions(+), 91 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 94140d12c63..978639d7ef9 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -75,13 +75,6 @@ _ocdav: api compatibility, return correct status code_ - [coreApiAuth/webDavLOCKAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature#L46) - [coreApiAuth/webDavLOCKAuth.feature:58](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavLOCKAuth.feature#L58) -#### [send POST requests to another user's webDav endpoints as normal user](https://github.com/owncloud/ocis/issues/1287) - -_ocdav: api compatibility, return correct status code_ - -- [coreApiAuth/webDavPOSTAuth.feature:46](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature#L46) -- [coreApiAuth/webDavPOSTAuth.feature:55](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature#L55) - #### [Missing properties in REPORT response](https://github.com/owncloud/ocis/issues/9780), [REPORT response has different date format for d:getlastmodified](https://github.com/owncloud/ocis/issues/9781), [d:getetag property has empty value in REPORT response](https://github.com/owncloud/ocis/issues/9783) - [coreApiWebdavOperations/search.feature:180](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavOperations/search.feature#L180) @@ -171,7 +164,7 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [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) -#### [HTTP status code differ while deleting file of another user's trash bin](https://github.com/owncloud/ocis/issues/3544) +#### [Trying to delete other user's trashbin item returns 409 for spaces path instead of 404](https://github.com/owncloud/ocis/issues/9791) - [coreApiTrashbin/trashbinDelete.feature:92](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature#L92) diff --git a/tests/acceptance/features/bootstrap/TrashbinContext.php b/tests/acceptance/features/bootstrap/TrashbinContext.php index 0a337c67a60..ee819bf54a4 100644 --- a/tests/acceptance/features/bootstrap/TrashbinContext.php +++ b/tests/acceptance/features/bootstrap/TrashbinContext.php @@ -502,41 +502,35 @@ public function theLastWebdavResponseShouldNotContainFollowingElements(TableNode } /** - * @When user :asUser tries to delete the file with original path :path from the trashbin of user :user using the trashbin API + * @When user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the trashbin API * - * @param string $asUser - * @param string $path * @param string $user + * @param string $path + * @param string $ofUser * * @return void * @throws Exception */ - public function userTriesToDeleteFromTrashbinOfUser(string $asUser, string $path, string $user):void { - $responseArray = $this->tryToDeleteFileFromTrashbin($user, $path, $asUser); - foreach ($responseArray as $response) { - $this->featureContext->setResponse($response); - } + public function userTriesToDeleteFromTrashbinOfUser(string $user, string $path, string $ofUser):void { + $response = $this->deleteItemFromTrashbin($user, $path, $ofUser); + $this->featureContext->setResponse($response); } /** - * @When user :asUser tries to delete the file with original path :path from the trashbin of user :user using the password :password and the trashbin API + * @When user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the password :password and the trashbin API * - * @param string|null $asUser - * @param string|null $path - * @param string|null $user - * @param string|null $password + * @param string $asUser + * @param string $path + * @param string $ofUser + * @param string $password * * @return void * @throws JsonException * @throws Exception */ - public function userTriesToDeleteFromTrashbinOfUserUsingPassword(?string $asUser, ?string $path, ?string $user, ?string $password):void { - $user = $this->featureContext->getActualUsername($user); - $asUser = $this->featureContext->getActualUsername($asUser); - $responseArray = $this->tryToDeleteFileFromTrashbin($user, $path, $asUser, $password); - foreach ($responseArray as $response) { - $this->featureContext->setResponse($response); - } + public function userTriesToDeleteFromTrashbinOfUserUsingPassword(string $user, string $path, string $ofUser, string $password):void { + $response = $this->deleteItemFromTrashbin($user, $path, $ofUser, $password); + $this->featureContext->setResponse($response); } /** @@ -601,51 +595,54 @@ private function convertTrashbinHref(string $href):string { * @return void */ public function userTriesToDeleteFileWithOriginalPathFromTrashbinUsingTrashbinAPI(string $user, string $originalPath):void { - $responseArray = $this->tryToDeleteFileFromTrashbin($user, $originalPath); - foreach ($responseArray as $response) { - $this->featureContext->setResponse($response); - } + $response = $this->deleteItemFromTrashbin($user, $originalPath); + $this->featureContext->setResponse($response); } /** - * @param string|null $user - * @param string|null $originalPath - * @param string|null $asUser + * @param string $user + * @param string $originalPath + * @param string|null $ofUser * @param string|null $password * - * @return array + * @return ResponseInterface */ - public function tryToDeleteFileFromTrashbin(?string $user, ?string $originalPath, ?string $asUser = null, ?string $password = null):array { + public function deleteItemFromTrashbin(string $user, string $originalPath, ?string $ofUser = null, ?string $password = null): ResponseInterface { + $ofUser = $ofUser ?? $user; $user = $this->featureContext->getActualUsername($user); - $asUser = $asUser ?? $user; - $listing = $this->listTrashbinFolder($user); - $originalPath = \trim($originalPath, '/'); + $ofUser = $this->featureContext->getActualUsername($ofUser); + + $listing = $this->listTrashbinFolder($ofUser); - $responseArray = []; + $path = ""; + $originalPath = \trim($originalPath, '/'); foreach ($listing as $entry) { // The entry for the trashbin root can have original-location null. // That is reasonable, because the trashbin root is not something that can be restored. $originalLocation = $entry['original-location'] ?? ''; if (\trim($originalLocation, '/') === $originalPath) { - $trashItemHRef = $this->convertTrashbinHref($entry['href']); - $response = $this->featureContext->makeDavRequest( - $asUser, - 'DELETE', - $trashItemHRef, - [], - null, - 'trash-bin', - null, - false, - $password, - [], - $user - ); - $responseArray[] = $response; + $path = $entry['href']; + break; } } - return $responseArray; + if ($path === "") { + throw new Exception( + __METHOD__ + . " could not find the trashbin entry for original path '$originalPath' of user '$user'" + ); + } + + $password = $password ?? $this->featureContext->getPasswordForUser($user); + $fullUrl = $this->featureContext->getBaseUrl() . $path; + + return HttpRequestHelper::sendRequest( + $fullUrl, + $this->featureContext->getStepLineRef(), + "DELETE", + $user, + $password + ); } /** @@ -658,16 +655,8 @@ public function tryToDeleteFileFromTrashbin(?string $user, ?string $originalPath * @throws Exception */ public function deleteFileFromTrashbin(string $user, string $originalPath):void { - $responseArray = $this->tryToDeleteFileFromTrashbin($user, $originalPath); - $numItemDeleted = \count($responseArray); - Assert::assertEquals( - 1, - $numItemDeleted, - "Expected to delete exactly one item from the trashbin but $numItemDeleted were deleted" - ); - foreach ($responseArray as $response) { - $this->featureContext->setResponse($response); - } + $response = $this->deleteItemFromTrashbin($user, $originalPath); + $this->featureContext->setResponse($response); $this->featureContext->pushToLastStatusCodesArrays(); } @@ -681,16 +670,8 @@ public function deleteFileFromTrashbin(string $user, string $originalPath):void * @throws Exception */ public function userHasDeletedTheFolderWithOriginalPathFromTheTrashbin(string $user, string $originalPath):void { - $responseArray = $this->tryToDeleteFileFromTrashbin($user, $originalPath); - $numItemDeleted = \count($responseArray); - Assert::assertEquals( - 1, - $numItemDeleted, - "Expected to delete exactly one item from the trashbin but $numItemDeleted were deleted" - ); - foreach ($responseArray as $response) { - $this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response); - } + $response = $this->deleteItemFromTrashbin($user, $originalPath); + $this->featureContext->theHTTPStatusCodeShouldBe(204, '', $response); } /** @@ -707,17 +688,8 @@ public function deleteFollowingFilesFromTrashbin(string $user, TableNode $table) $paths = $table->getHash(); foreach ($paths as $path) { - $responseArray = $this->tryToDeleteFileFromTrashbin($user, $path["path"]); - $numItemsDeleted = \count($responseArray); - - Assert::assertEquals( - 1, - $numItemsDeleted, - "Expected to delete exactly one item from the trashbin but $numItemsDeleted were deleted" - ); - foreach ($responseArray as $response) { - $this->featureContext->setResponse($response); - } + $response = $this->deleteItemFromTrashbin($user, $path["path"]); + $this->featureContext->setResponse($response); $this->featureContext->pushToLastStatusCodesArrays(); } } diff --git a/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature b/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature index f1a191f8221..76b87436eb9 100644 --- a/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature +++ b/tests/acceptance/features/coreApiAuth/webDavPOSTAuth.feature @@ -49,7 +49,7 @@ Feature: POST file/folder | /remote.php/dav/files/%username%/textfile1.txt | | /remote.php/dav/files/%username%/PARENT | | /remote.php/dav/files/%username%/PARENT/parent.txt | - Then the HTTP status code of responses on all endpoints should be "404" + Then the HTTP status code of responses on all endpoints should be "412" @issue-1287 Scenario: send POST requests to another user's webDav endpoints as normal user using the spaces WebDAV API @@ -58,7 +58,7 @@ Feature: POST file/folder | /remote.php/dav/spaces/%spaceid%/textfile0.txt | | /remote.php/dav/spaces/%spaceid%/PARENT | | /remote.php/dav/spaces/%spaceid%/PARENT/parent.txt | - Then the HTTP status code of responses on all endpoints should be "404" + Then the HTTP status code of responses on all endpoints should be "412" Scenario: send POST requests to webDav endpoints using invalid username but correct password diff --git a/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature b/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature index e3e5f5c09d4..cec76781bb4 100644 --- a/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature +++ b/tests/acceptance/features/coreApiTrashbin/trashbinDelete.feature @@ -72,7 +72,7 @@ Feature: files and folders can be deleted from the trashbin | new | | spaces | - + @issue-3544 @issue-9791 Scenario Outline: user tries to delete another user's trashbin Given using DAV path And user "Brian" has been created with default attributes and without skeleton files From f8530c060c45a39523d819547ab6be26078e6f39 Mon Sep 17 00:00:00 2001 From: Saw-jan Date: Tue, 13 Aug 2024 12:05:22 +0545 Subject: [PATCH 4/4] test: update expected-failure lines --- tests/acceptance/expected-failures-API-on-OCIS-storage.md | 6 +++--- tests/acceptance/features/bootstrap/TrashbinContext.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 978639d7ef9..e4147f4e0bf 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -182,9 +182,9 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers ### [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:1071](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1071) -- [coreApiWebdavProperties/copyFile.feature:1072](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1072) -- [coreApiWebdavProperties/copyFile.feature:1073](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1073) +- [coreApiWebdavProperties/copyFile.feature:1067](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1067) +- [coreApiWebdavProperties/copyFile.feature:1068](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1068) +- [coreApiWebdavProperties/copyFile.feature:1069](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiWebdavProperties/copyFile.feature#L1069) 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/features/bootstrap/TrashbinContext.php b/tests/acceptance/features/bootstrap/TrashbinContext.php index ee819bf54a4..65f246819ef 100644 --- a/tests/acceptance/features/bootstrap/TrashbinContext.php +++ b/tests/acceptance/features/bootstrap/TrashbinContext.php @@ -519,7 +519,7 @@ public function userTriesToDeleteFromTrashbinOfUser(string $user, string $path, /** * @When user :user tries to delete the file with original path :path from the trashbin of user :ofUser using the password :password and the trashbin API * - * @param string $asUser + * @param string $user * @param string $path * @param string $ofUser * @param string $password