From 4f8fd47058e4eb35271f7486a24ca3f53883a554 Mon Sep 17 00:00:00 2001 From: Niraj Acharya Date: Fri, 8 Nov 2024 16:11:23 +0545 Subject: [PATCH] adding test for editing shared file(OCM) by the share receiver --- tests/acceptance/bootstrap/SpacesContext.php | 27 +++++++++++++++++++ .../acceptance/features/apiOcm/share.feature | 23 ++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/tests/acceptance/bootstrap/SpacesContext.php b/tests/acceptance/bootstrap/SpacesContext.php index 0695f0c235..eb67adab59 100644 --- a/tests/acceptance/bootstrap/SpacesContext.php +++ b/tests/acceptance/bootstrap/SpacesContext.php @@ -1345,6 +1345,33 @@ class SpacesContext implements Context { $this->featureContext->setResponse($response); } + /** + * @When user :user updates the content of federated share :share with :content using the WebDAV API + * + * @param string $user + * @param string $share + * @param string $content + * + * @return void + * @throws GuzzleException + * @throws Exception + */ + public function userUpdatesTheContentOfFederatedShareWithUsingTheWebdavApi( + string $user, + string $share, + string $content, + ): void { + $spaceId = $this->getSharesRemoteItemId($user, $share); + $this->featureContext->setResponse( + $this->featureContext->uploadFileWithContent( + $user, + $content, + '', + $spaceId + ) + ); + } + /** * @When /^user "([^"]*)" uploads a file "([^"]*)" to "([^"]*)" in space "([^"]*)" using the WebDAV API$/ * diff --git a/tests/acceptance/features/apiOcm/share.feature b/tests/acceptance/features/apiOcm/share.feature index 0aacfeb0d8..5ce6bbcca1 100755 --- a/tests/acceptance/features/apiOcm/share.feature +++ b/tests/acceptance/features/apiOcm/share.feature @@ -753,3 +753,26 @@ Feature: an user shares resources using ScienceMesh application Then the HTTP status code should be "200" And the downloaded image should be "32" pixels wide and "32" pixels high And the downloaded preview content should match with "thumbnail.png" fixtures preview content + + @issue-10358 + Scenario: user edits content of a federated share file + Given using spaces DAV path + And using server "LOCAL" + And "Alice" has created the federation share invitation + And using server "REMOTE" + And "Brian" has accepted invitation + And using server "LOCAL" + And user "Alice" has uploaded file with content "ocm test" to "/textfile.txt" + And user "Alice" has sent the following resource share invitation to federated user: + | resource | textfile.txt | + | space | Personal | + | sharee | Brian | + | shareType | user | + | permissionsRole | File Editor | + And using server "REMOTE" + And for user "Brian" the content of file "textfile.txt" of federated share "textfile.txt" should be "ocm test" + When user "Brian" updates the content of federated share "textfile.txt" with "this is a new content" using the WebDAV API + Then the HTTP status code should be "204" + And for user "Brian" the content of file "textfile.txt" of federated share "textfile.txt" should be "this is a new content" + And using server "LOCAL" + And for user "Alice" the content of the file "textfile.txt" of the space "Personal" should be "this is a new content"