From 2b1f6bc51399f1c851732ea1a4d1a428a3f758b0 Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Fri, 22 Jul 2022 10:14:06 +0545 Subject: [PATCH 1/2] Move Implementation operation --- .../features/bootstrap/SpacesContext.php | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index 4e1a1be02..c7d341387 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -1747,6 +1747,56 @@ class SpacesContext implements Context { $this->copyFilesAndFoldersRequest($user, $fullUrl, $headers); } + /** + * @When /^user "([^"]*)" moves (?:file|folder) "([^"]*)" to "([^"]*)" in space "([^"]*)" using the WebDAV API$/ + * + * @param string $user + * @param string $fileSource + * @param string $fileDestination + * @param string $spaceName + * + * @return void + */ + public function userMovesFileWithinSpaceUsingTheWebDAVAPI( + string $user, + string $fileSource, + string $fileDestination, + string $spaceName + ):void { + $space = $this->getSpaceByName($user, $spaceName); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName( + $user, + $fileDestination, + $spaceName + ); + + $fullUrl = $space["root"]["webDavUrl"] . '/' . \trim($fileSource, "/"); + $this->moveFilesAndFoldersRequest($user, $fullUrl, $headers); + } + + /** + * MOVE request for files|folders + * + * @param string $user + * @param string $fullUrl + * @param string $headers + * + * @return void + * @throws GuzzleException + */ + public function moveFilesAndFoldersRequest(string $user, string $fullUrl, array $headers):void { + $this->featureContext->setResponse( + HttpRequestHelper::sendRequest( + $fullUrl, + $this->featureContext->getStepLineRef(), + 'MOVE', + $user, + $this->featureContext->getPasswordForUser($user), + $headers, + ) + ); + } + /** * @When /^user "([^"]*)" copies (?:file|folder) "([^"]*)" from space "([^"]*)" to "([^"]*)" inside space "([^"]*)" using the WebDAV API$/ * @@ -1772,6 +1822,32 @@ class SpacesContext implements Context { $this->copyFilesAndFoldersRequest($user, $fullUrl, $headers); } + + /** + * @When /^user "([^"]*)" moves (?:file|folder) "([^"]*)" from space "([^"]*)" to "([^"]*)" inside space "([^"]*)" using the WebDAV API$/ + * + * @param string $user + * @param string $fileSource + * @param string $fromSpaceName + * @param string $fileDestination + * @param string $toSpaceName + * + * @return void + * @throws GuzzleException + */ + public function userMovesFileFromAndToSpaceBetweenSpaces( + string $user, + string $fileSource, + string $fromSpaceName, + string $fileDestination, + string $toSpaceName + ):void { + $space = $this->getSpaceByName($user, $fromSpaceName); + $headers['Destination'] = $this->destinationHeaderValueWithSpaceName($user, $fileDestination, $toSpaceName); + $fullUrl = $space["root"]["webDavUrl"] . '/' . \ltrim($fileSource, "/"); + $this->moveFilesAndFoldersRequest($user, $fullUrl, $headers); + } + /** * returns a url for destination with spacename * From b83dfe9f732b8ee047370ce5c7cf23464debdce0 Mon Sep 17 00:00:00 2001 From: Swikriti Tripathi Date: Fri, 22 Jul 2022 14:07:21 +0545 Subject: [PATCH 2/2] Add etag related tests removed by core-40226 --- .drone.env | 2 +- .../expected-failures-API-on-OCIS-storage.md | 12 - .../apiSpaces/etagPropagation.feature | 271 +++++++++++++++++- 3 files changed, 263 insertions(+), 22 deletions(-) diff --git a/.drone.env b/.drone.env index a529d4f67..a4bc77fd5 100644 --- a/.drone.env +++ b/.drone.env @@ -1,5 +1,5 @@ # The test runner source for API tests -CORE_COMMITID=9205d3c6b720404200e7733a5805b9d4177d00ac +CORE_COMMITID=11d71074d4e9f44e4367af22421c857629f24c59 CORE_BRANCH=master # The test runner source for UI tests diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 5bac71fd2..a0305c87a 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -1006,22 +1006,10 @@ And other missing implementation of favorites - [apiWebdavUploadTUS/uploadToShare.feature:254](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L254) - [apiWebdavUploadTUS/uploadToShare.feature:301](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L301) - [apiWebdavUploadTUS/uploadToShare.feature:326](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavUploadTUS/uploadToShare.feature#L326) -- [apiWebdavEtagPropagation1/moveFileFolder.feature:189](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/moveFileFolder.feature#L189) -- [apiWebdavEtagPropagation1/moveFileFolder.feature:223](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/moveFileFolder.feature#L223) -- [apiWebdavEtagPropagation1/moveFileFolder.feature:264](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/moveFileFolder.feature#L264) -- [apiWebdavEtagPropagation1/moveFileFolder.feature:305](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/moveFileFolder.feature#L305) -- [apiWebdavEtagPropagation1/moveFileFolder.feature:346](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/moveFileFolder.feature#L346) -- [apiWebdavEtagPropagation1/moveFileFolder.feature:387](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/moveFileFolder.feature#L387) - [apiWebdavEtagPropagation1/deleteFileFolder.feature:120](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L120) - [apiWebdavEtagPropagation1/deleteFileFolder.feature:156](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L156) - [apiWebdavEtagPropagation1/deleteFileFolder.feature:194](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L194) - [apiWebdavEtagPropagation1/deleteFileFolder.feature:232](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation1/deleteFileFolder.feature#L232) -- [apiWebdavEtagPropagation2/createFolder.feature:85](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/createFolder.feature#L85) -- [apiWebdavEtagPropagation2/createFolder.feature:116](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/createFolder.feature#L116) -- [apiWebdavEtagPropagation2/upload.feature:83](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/upload.feature#L83) -- [apiWebdavEtagPropagation2/upload.feature:113](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/upload.feature#L113) -- [apiWebdavEtagPropagation2/upload.feature:144](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/upload.feature#L144) -- [apiWebdavEtagPropagation2/upload.feature:175](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavEtagPropagation2/upload.feature#L175) - [apiWebdavLocks2/resharedSharesToShares.feature:117](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L117) - [apiWebdavLocks2/resharedSharesToShares.feature:118](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L118) - [apiWebdavLocks2/resharedSharesToShares.feature:144](https://github.com/owncloud/core/blob/master/tests/acceptance/features/apiWebdavLocks2/resharedSharesToShares.feature#L144) diff --git a/tests/acceptance/features/apiSpaces/etagPropagation.feature b/tests/acceptance/features/apiSpaces/etagPropagation.feature index 306b491ae..c861a8948 100644 --- a/tests/acceptance/features/apiSpaces/etagPropagation.feature +++ b/tests/acceptance/features/apiSpaces/etagPropagation.feature @@ -1,12 +1,16 @@ @api Feature: check etag propagation after different file alterations - Scenario: copying a file inside a folder as a share receiver changes its etag for all collaborators - Given user "Alice" has been created with default attributes and without skeleton files - And user "Brian" has been created with default attributes and without skeleton files + Background: + Given these users have been created with default attributes and without skeleton files: + | username | + | Alice | + | Brian | And using spaces DAV path And user "Alice" has created folder "/upload" - And user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + + Scenario: copying a file inside a folder as a share receiver changes its etag for all collaborators + Given user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" And user "Alice" has shared folder "/upload" with user "Brian" And user "Brian" has accepted share "/upload" offered by user "Alice" And user "Alice" has stored etag of element "/" inside space "Personal" @@ -33,11 +37,7 @@ Feature: check etag propagation after different file alterations | Brian | /upload/file.txt | Shares Jail | Scenario: copying a file inside a folder as a sharer changes its etag for all collaborators - Given user "Alice" has been created with default attributes and without skeleton files - Given user "Brian" has been created with default attributes and without skeleton files - And using spaces DAV path - And user "Alice" has created folder "/upload" - And user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + Given user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" And user "Alice" has shared folder "/upload" with user "Brian" And user "Brian" has accepted share "/upload" offered by user "Alice" And user "Alice" has stored etag of element "/" inside space "Personal" @@ -62,3 +62,256 @@ Feature: check etag propagation after different file alterations | user | path | space | | Alice | /upload/file.txt | Personal | | Brian | /upload/file.txt | Shares Jail | + + + Scenario: as share receiver renaming a file inside a folder changes its etag for all collaborators + Given user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/upload/file.txt" on path "/upload/renamed.txt" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload/file.txt" on path "/upload/renamed.txt" inside space "Shares Jail" + When user "Brian" moves file "/upload/file.txt" to "/upload/renamed.txt" in space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + And these etags should not have changed + | user | path | space | + | Alice | /upload/renamed.txt | Personal | + | Brian | /upload/renamed.txt | Shares Jail | + + + Scenario: as sharer renaming a file inside a folder changes its etag for all collaborators + Given user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/upload/file.txt" on path "/upload/renamed.txt" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload/file.txt" on path "/upload/renamed.txt" inside space "Shares Jail" + When user "Alice" moves file "/upload/file.txt" to "/upload/renamed.txt" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + And these etags should not have changed + | user | path | space | + | Alice | /upload/renamed.txt | Personal | + | Brian | /upload/renamed.txt | Shares Jail | + + + Scenario: as sharer moving a file from one folder to an other changes the etags of both folders for all collaborators + Given user "Alice" has created folder "/dst" + And user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has shared folder "/dst" with user "Brian" + And user "Brian" has accepted share "/dst" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/dst" inside space "Personal" + And user "Alice" has stored etag of element "/upload/file.txt" on path "/dst/file.txt" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/dst" inside space "Shares Jail" + When user "Alice" moves file "/upload/file.txt" to "/dst/file.txt" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /dst | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /dst | Shares Jail | + + + Scenario: as share receiver moving a file from one folder to an other changes the etags of both folders for all collaborators + Given user "Alice" has created folder "/dst" + And user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has shared folder "/dst" with user "Brian" + And user "Brian" has accepted share "/dst" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/dst" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/dst" inside space "Shares Jail" + When user "Brian" moves file "/upload/file.txt" to "/dst/file.txt" in space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /dst | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /dst | Shares Jail | + + + Scenario: as sharer moving a folder from one folder to an other changes the etags of both folders for all collaborators + Given user "Alice" has created folder "/dst" + And user "Alice" has created folder "/upload/toMove" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has shared folder "/dst" with user "Brian" + And user "Brian" has accepted share "/dst" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/dst" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/dst" inside space "Shares Jail" + When user "Alice" moves file "/upload/toMove" to "/dst/toMove" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /dst | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /dst | Shares Jail | + + + Scenario: as share reciever moving a folder from one folder to an other changes the etags of both folders for all collaborators + Given user "Alice" has created folder "/dst" + And user "Alice" has created folder "/upload/toMove" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has shared folder "/dst" with user "Brian" + And user "Brian" has accepted share "/dst" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Alice" has stored etag of element "/dst" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + And user "Brian" has stored etag of element "/dst" inside space "Shares Jail" + When user "Brian" moves file "/upload/toMove" to "/dst/toMove" in space "Shares Jail" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Alice | /dst | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + | Brian | /dst | Shares Jail | + + + Scenario: as share receiver creating a folder inside a folder received as a share changes its etag for all collaborators + Given user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + When user "Brian" creates a subfolder "/upload/new" in space "Shares Jail" using the WebDav Api + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + + + Scenario: as sharer creating a folder inside a shared folder changes etag for all collaborators + Given user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + When user "Alice" creates folder "/upload/new" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + + + Scenario: as share receiver uploading a file inside a folder received as a share changes its etag for all collaborators + Given user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + When user "Brian" uploads a file inside space "Shares Jail" with content "uploaded content" to "/upload/file.txt" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + + + Scenario: as sharer uploading a file inside a shared folder should update etags for all collaborators + Given user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + When user "Alice" uploads file with content "uploaded content" to "/upload/file.txt" using the WebDAV API + Then the HTTP status code should be "201" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + + + Scenario: as share receiver overwriting a file inside a received shared folder should update etags for all collaborators + Given user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + When user "Brian" uploads a file inside space "Shares Jail" with content "new content" to "/upload/file.txt" using the WebDAV API + Then the HTTP status code should be "204" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail | + + + Scenario: as sharer overwriting a file inside a shared folder should update etags for all collaborators + Given user "Alice" has uploaded file with content "uploaded content" to "/upload/file.txt" + And user "Alice" has shared folder "/upload" with user "Brian" + And user "Brian" has accepted share "/upload" offered by user "Alice" + And user "Alice" has stored etag of element "/" inside space "Personal" + And user "Alice" has stored etag of element "/upload" inside space "Personal" + And user "Brian" has stored etag of element "/" inside space "Shares Jail" + And user "Brian" has stored etag of element "/upload" inside space "Shares Jail" + When user "Alice" uploads file with content "new content" to "/upload/file.txt" using the WebDAV API + Then the HTTP status code should be "204" + And these etags should have changed + | user | path | space | + | Alice | / | Personal | + | Alice | /upload | Personal | + | Brian | / | Shares Jail | + | Brian | /upload | Shares Jail |