From 803d59f2ea25404c1b1dec0a414348a97e2c193a Mon Sep 17 00:00:00 2001 From: Sabin Date: Mon, 19 Jun 2023 09:16:13 +0545 Subject: [PATCH 1/4] added unshare scenerio --- .../acceptance/features/bootstrap/Sharing.php | 34 +++++++++++++++++++ .../deleteShareFromShares.feature | 14 +++++++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 0175c40df8a..a6bde349146 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -3583,6 +3583,40 @@ public function userHasUnsharedResourceSharedTo(string $sharer, string $path, st $this->emptyLastOCSStatusCodesArray(); } + /** + * @When /^user "([^"]*)" unshares (?:folder|file|entity) "([^"]*)" shared to "([^"]*)"$/ + * + * @param string $sharer + * @param string $path + * @param string $sharee + * + * @return void + * @throws JsonException + */ + public function userUnsharesSharedTo(string $sharer, string $path, string $sharee): void { + $sharer = $this->getActualUsername($sharer); + $sharee = $this->getActualUsername($sharee); + + $response = $this->getShares($sharer, "$path&share_types=0"); + $shareId = null; + foreach ($response as $shareElement) { + if ((string)$shareElement->share_with[0] === $sharee) { + $shareId = (string) $shareElement->id; + break; + } + } + Assert::assertNotNull( + $shareId, + __METHOD__ . " could not find share, offered by $sharer to $sharee" + ); + + $this->ocsContext->userSendsHTTPMethodToOcsApiEndpointWithBody( + $sharer, + 'DELETE', + '/apps/files_sharing/api/v' . $this->sharingApiVersion . '/shares/' . $shareId + ); + } + /** * @Then the sharing API should report that no shares are shared with user :user * diff --git a/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature b/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature index 3bd6210a7d2..2023070fd28 100644 --- a/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature +++ b/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature @@ -74,7 +74,7 @@ Feature: sharing And as "Alice" file "/shared_file.txt" should exist in the trashbin And as "Brian" file "/shared_file.txt" should exist in the trashbin - + Scenario: deleting a folder out of a share as recipient creates a backup for the owner Given using OCS API version "1" And user "Alice" has created folder "/shared" @@ -226,3 +226,15 @@ Feature: sharing | ocs_api_version | ocs_status_code | http_status_code | | 1 | 404 | 200 | | 2 | 404 | 404 | + + + Scenario: unshare a shared resources + Given using OCS API version "1" + And user "Alice" has shared file "textfile0.txt" with user "Brian" + And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice" + When user "Alice" unshares file "textfile0.txt" shared to "Brian" +# Then the OCS status code should be "200" + Then the HTTP status code should be "204" + And as "Brian" file "/Shares/shared/textfile0.txt" should not exist + + From 3580e7520dd4a5de490a9ab103baec9479b80aa1 Mon Sep 17 00:00:00 2001 From: Sabin Date: Mon, 19 Jun 2023 10:14:25 +0545 Subject: [PATCH 2/4] remove unshare keyword from step definition --- .../acceptance/features/bootstrap/Sharing.php | 59 ++++++------------- .../acceptance/features/bootstrap/WebDav.php | 2 +- .../deleteShareFromShares.feature | 4 +- .../coreApiVersions/fileVersions.feature | 2 +- 4 files changed, 23 insertions(+), 44 deletions(-) diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index a6bde349146..bfeee5aff86 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -3554,6 +3554,25 @@ public function assertNoSharesOfUserAreInState(string $user, string $state):void * @throws JsonException */ public function userHasUnsharedResourceSharedTo(string $sharer, string $path, string $sharee): void { + $this->userUnsharesSharedTo($sharer, $path, $sharee); + $this->ocsContext->assertOCSResponseIndicatesSuccess( + 'The ocs share response does not indicate success.', + ); + $this->emptyLastHTTPStatusCodesArray(); + $this->emptyLastOCSStatusCodesArray(); + } + + /** + * @When /^user "([^"]*)" unshares (?:folder|file|entity) "([^"]*)" shared to "([^"]*)"$/ + * + * @param string $sharer + * @param string $path + * @param string $sharee + * + * @return void + * @throws JsonException + */ + public function userUnsharesSharedTo(string $sharer, string $path, string $sharee): void { $sharer = $this->getActualUsername($sharer); $sharee = $this->getActualUsername($sharee); @@ -3575,48 +3594,8 @@ public function userHasUnsharedResourceSharedTo(string $sharer, string $path, st 'DELETE', '/apps/files_sharing/api/v' . $this->sharingApiVersion . '/shares/' . $shareId ); - - $this->ocsContext->assertOCSResponseIndicatesSuccess( - 'The ocs share response does not indicate success.', - ); - $this->emptyLastHTTPStatusCodesArray(); - $this->emptyLastOCSStatusCodesArray(); } - /** - * @When /^user "([^"]*)" unshares (?:folder|file|entity) "([^"]*)" shared to "([^"]*)"$/ - * - * @param string $sharer - * @param string $path - * @param string $sharee - * - * @return void - * @throws JsonException - */ - public function userUnsharesSharedTo(string $sharer, string $path, string $sharee): void { - $sharer = $this->getActualUsername($sharer); - $sharee = $this->getActualUsername($sharee); - - $response = $this->getShares($sharer, "$path&share_types=0"); - $shareId = null; - foreach ($response as $shareElement) { - if ((string)$shareElement->share_with[0] === $sharee) { - $shareId = (string) $shareElement->id; - break; - } - } - Assert::assertNotNull( - $shareId, - __METHOD__ . " could not find share, offered by $sharer to $sharee" - ); - - $this->ocsContext->userSendsHTTPMethodToOcsApiEndpointWithBody( - $sharer, - 'DELETE', - '/apps/files_sharing/api/v' . $this->sharingApiVersion . '/shares/' . $shareId - ); - } - /** * @Then the sharing API should report that no shares are shared with user :user * diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 2bf82133033..5e2835638b2 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -3338,7 +3338,7 @@ public function fileHasBeenDeleted(string $file, string $user):void { } /** - * @When /^user "([^"]*)" (?:deletes|unshares) (?:file|folder) "([^"]*)" using the WebDAV API$/ + * @When /^user "([^"]*)" deletes (?:file|folder) "([^"]*)" using the WebDAV API$/ * * @param string $user * @param string $file diff --git a/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature b/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature index 2023070fd28..0671417a878 100644 --- a/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature +++ b/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature @@ -233,8 +233,8 @@ Feature: sharing And user "Alice" has shared file "textfile0.txt" with user "Brian" And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice" When user "Alice" unshares file "textfile0.txt" shared to "Brian" -# Then the OCS status code should be "200" - Then the HTTP status code should be "204" + Then the OCS status code should be "100" + And the HTTP status code should be "200" And as "Brian" file "/Shares/shared/textfile0.txt" should not exist diff --git a/tests/acceptance/features/coreApiVersions/fileVersions.feature b/tests/acceptance/features/coreApiVersions/fileVersions.feature index 07f4aa9e1aa..5ae11ba824b 100644 --- a/tests/acceptance/features/coreApiVersions/fileVersions.feature +++ b/tests/acceptance/features/coreApiVersions/fileVersions.feature @@ -421,7 +421,7 @@ Feature: dav-versions | new | Brian | /testshare | - Scenario: receiver tries to get file versions of unshared file from the sharer + Scenario: receiver tries to get file versions of file not shared by the sharer Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "textfile0" to "textfile0.txt" And user "Alice" has uploaded file with content "textfile1" to "textfile1.txt" From 4f8ebacaa287fa560cca0a3dc18bb936e27e1dcb Mon Sep 17 00:00:00 2001 From: Sabin Date: Thu, 22 Jun 2023 17:10:51 +0545 Subject: [PATCH 3/4] refactoring of step definition codes --- tests/TestHelpers/HttpRequestHelper.php | 1 + .../acceptance/features/bootstrap/Sharing.php | 1 + .../acceptance/features/bootstrap/WebDav.php | 52 +++++++------------ ...hareDefaultFolderForReceivedShares.feature | 8 +-- 4 files changed, 25 insertions(+), 37 deletions(-) diff --git a/tests/TestHelpers/HttpRequestHelper.php b/tests/TestHelpers/HttpRequestHelper.php index 6ea21878610..f72654ab56f 100644 --- a/tests/TestHelpers/HttpRequestHelper.php +++ b/tests/TestHelpers/HttpRequestHelper.php @@ -200,6 +200,7 @@ public static function sendRequest( $sendRetryLimit = self::numRetriesOnHttpTooEarly(); $sendCount = 0; $sendExceptionHappened = false; + var_dump($url,$method,$user,$body); do { $response = self::sendRequestOnce( $url, diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index bfeee5aff86..7fee93c6480 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -3345,6 +3345,7 @@ public function userReactsToShareOfferedBy(string $user, string $action, string $url ); $this->pushToLastStatusCodesArrays(); + } /** diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 5e2835638b2..41464b2cb3b 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -3354,58 +3354,51 @@ public function userDeletesFile(string $user, string $file):void { } /** - * @Given /^user "([^"]*)" has (deleted|unshared) (?:file|folder|entity) "([^"]*)"$/ + * @Given /^user "([^"]*)" has deleted (?:file|folder|entity) "([^"]*)"$/ * * @param string $user - * @param string $deletedOrUnshared - * @param string $entry + * @param string $resource * * @return void * @throws Exception */ - public function userHasDeletedFile(string $user, string $deletedOrUnshared, string $entry):void { + public function userHasDeletedFile(string $user, string $resource):void { $user = $this->getActualUsername($user); - $this->userDeletesFile($user, $entry); + $this->userDeletesFile($user, $resource); // If the file or folder was there and got deleted then we get a 204 // That is good and the expected status // If the file or folder was already not there then we get a 404 // That is not expected. Scenarios that use "Given user has deleted..." // should only be using such steps when it is a file that exists and needs // to be deleted. - if ($deletedOrUnshared === "deleted") { - $deleteText = "delete"; - } else { - $deleteText = "unshare"; - } $this->theHTTPStatusCodeShouldBe( ["204"], - "HTTP status code was not 204 while trying to $deleteText resource '$entry' for user '$user'" + "HTTP status code was not 204 while trying to delete resource '$resource' for user '$user'" ); $this->emptyLastHTTPStatusCodesArray(); } /** - * @Given /^user "([^"]*)" has (deleted|unshared) the following (?:files|folders|resources)$/ + * @Given /^user "([^"]*)" has deleted the following (?:files|folders|resources)$/ * * @param string $user - * @param string $deletedOrUnshared * @param TableNode $table * * @return void * @throws Exception */ - public function userHasDeletedFollowingFiles(string $user, string $deletedOrUnshared, TableNode $table):void { + public function userHasDeletedFollowingFiles(string $user, TableNode $table):void { $this->verifyTableNodeColumns($table, ["path"]); $paths = $table->getHash(); foreach ($paths as $file) { - $this->userHasDeletedFile($user, $deletedOrUnshared, $file["path"]); + $this->userHasDeletedFile($user, $file["path"]); } } /** - * @When /^user "([^"]*)" (?:deletes|unshares) the following (?:files|folders)$/ + * @When /^user "([^"]*)" deletes the following (?:files|folders)$/ * * @param string $user * @param TableNode $table @@ -3425,7 +3418,7 @@ public function userDeletesFollowingFiles(string $user, TableNode $table):void { } /** - * @When /^the user (?:deletes|unshares) (?:file|folder) "([^"]*)" using the WebDAV API$/ + * @When /^the user deletes (?:file|folder) "([^"]*)" using the WebDAV API$/ * * @param string $file * @@ -3436,20 +3429,19 @@ public function theUserDeletesFile(string $file):void { } /** - * @Given /^the user has (deleted|unshared) (file|folder) "([^"]*)"$/ + * @Given /^the user has deleted (file|folder) "([^"]*)"$/ * - * @param string $deletedOrUnshared * @param string $fileOrFolder * @param string $file * * @return void */ - public function theUserHasDeletedFile(string $deletedOrUnshared, string $fileOrFolder, string $file):void { - $this->userHasDeletedFile($this->getCurrentUser(), $deletedOrUnshared, $fileOrFolder, $file); + public function theUserHasDeletedFile(string $fileOrFolder, string $file):void { + $this->userHasDeletedFile($this->getCurrentUser(),$fileOrFolder, $file); } /** - * @When /^user "([^"]*)" (?:deletes|unshares) these (?:files|folders|entries) without delays using the WebDAV API$/ + * @When /^user "([^"]*)" deletes these (?:files|folders|entries) without delays using the WebDAV API$/ * * @param string $user * @param TableNode $table of files or folders to delete @@ -3469,7 +3461,7 @@ public function userDeletesFilesFoldersWithoutDelays(string $user, TableNode $ta } /** - * @When /^the user (?:deletes|unshares) these (?:files|folders|entries) without delays using the WebDAV API$/ + * @When /^the user deletes these (?:files|folders|entries) without delays using the WebDAV API$/ * * @param TableNode $table of files or folders to delete * @@ -3481,7 +3473,7 @@ public function theUserDeletesFilesFoldersWithoutDelays(TableNode $table):void { } /** - * @When /^user "([^"]*)" on "(LOCAL|REMOTE)" (?:deletes|unshares) (?:file|folder) "([^"]*)" using the WebDAV API$/ + * @When /^user "([^"]*)" on "(LOCAL|REMOTE)" deletes (?:file|folder) "([^"]*)" using the WebDAV API$/ * * @param string $user * @param string $server @@ -3496,30 +3488,24 @@ public function userOnDeletesFile(string $user, string $server, string $file):vo } /** - * @Given /^user "([^"]*)" on "(LOCAL|REMOTE)" has (deleted|unshared) (file|folder) "([^"]*)"$/ + * @Given /^user "([^"]*)" on "(LOCAL|REMOTE)" has deleted (file|folder) "([^"]*)"$/ * * @param string $user * @param string $server - * @param string $deletedOrUnshared * @param string $fileOrFolder * @param string $entry * * @return void */ - public function userOnHasDeletedFile(string $user, string $server, string $deletedOrUnshared, string $fileOrFolder, string $entry):void { + public function userOnHasDeletedFile(string $user, string $server, string $fileOrFolder, string $entry):void { $this->userOnDeletesFile($user, $server, $entry); // If the file was there and got deleted then we get a 204 // If the file was already not there then we get a 404 // Either way, the outcome of the "given" step is OK - if ($deletedOrUnshared === "deleted") { - $deleteText = "delete"; - } else { - $deleteText = "unshare"; - } $this->theHTTPStatusCodeShouldBe( ["204", "404"], - "HTTP status code was not 204 or 404 while trying to $deleteText $fileOrFolder '$entry' for user '$user' on server '$server'" + "HTTP status code was not 204 or 404 while trying to delete $fileOrFolder '$entry' for user '$user' on server '$server'" ); } diff --git a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature index ea2a685ee49..f98b0d1c787 100644 --- a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature +++ b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature @@ -14,11 +14,11 @@ Feature: shares are received in the default folder for received shares And user "Alice" has created folder "FOLDER" When user "Alice" shares folder "/FOLDER" with user "Brian" using the sharing API And user "Brian" accepts share "/FOLDER" offered by user "Alice" using the sharing API - And user "Brian" unshares folder "Shares/FOLDER" using the WebDAV API + When user "Brian" declines share "/Shares/FOLDER" offered by user "Alice" using the sharing API And user "Brian" shares folder "/Shares" with user "Alice" using the sharing API Then the OCS status code of responses on each endpoint should be "" respectively And the HTTP status code of responses on each endpoint should be "" respectively Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100, 100, 400 | 200, 200, 204, 200 | - | 2 | 200, 200, 400 | 200, 200, 204, 400 | + | ocs_api_version | ocs_status_code | http_status_code | + | 1 | 100, 100,100,404 | 200, 200, 200, 200 | + | 2 | 200, 200,200,404 | 200, 200, 200, 400 | From 9e1c1bb29b73967f9533a257fe4ac82eb452182f Mon Sep 17 00:00:00 2001 From: Sabin Date: Wed, 28 Jun 2023 10:40:10 +0545 Subject: [PATCH 4/4] refactor --- tests/TestHelpers/HttpRequestHelper.php | 1 - tests/TestHelpers/SharingHelper.php | 1 - .../expected-failures-API-on-OCIS-storage.md | 2 +- .../acceptance/features/bootstrap/Sharing.php | 5 ++-- .../acceptance/features/bootstrap/WebDav.php | 18 ++++++------- ...hareDefaultFolderForReceivedShares.feature | 8 +++--- .../deleteShareFromShares.feature | 26 ++++++++++--------- .../coreApiVersions/fileVersions.feature | 2 +- 8 files changed, 31 insertions(+), 32 deletions(-) diff --git a/tests/TestHelpers/HttpRequestHelper.php b/tests/TestHelpers/HttpRequestHelper.php index f72654ab56f..6ea21878610 100644 --- a/tests/TestHelpers/HttpRequestHelper.php +++ b/tests/TestHelpers/HttpRequestHelper.php @@ -200,7 +200,6 @@ public static function sendRequest( $sendRetryLimit = self::numRetriesOnHttpTooEarly(); $sendCount = 0; $sendExceptionHappened = false; - var_dump($url,$method,$user,$body); do { $response = self::sendRequestOnce( $url, diff --git a/tests/TestHelpers/SharingHelper.php b/tests/TestHelpers/SharingHelper.php index da3458a68fd..a58c154fbd3 100644 --- a/tests/TestHelpers/SharingHelper.php +++ b/tests/TestHelpers/SharingHelper.php @@ -158,7 +158,6 @@ public static function createShare( $fd['expireDate'] = $expireDate; } $headers = ['OCS-APIREQUEST' => 'true']; - return HttpRequestHelper::post( $fullUrl, $xRequestId, diff --git a/tests/acceptance/expected-failures-API-on-OCIS-storage.md b/tests/acceptance/expected-failures-API-on-OCIS-storage.md index 4dcf6a97450..bc9edd3c266 100644 --- a/tests/acceptance/expected-failures-API-on-OCIS-storage.md +++ b/tests/acceptance/expected-failures-API-on-OCIS-storage.md @@ -642,7 +642,7 @@ Not everything needs to be implemented for ocis. While the oc10 testsuite covers - [coreApiCapabilities/capabilities.feature:136](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiCapabilities/capabilities.feature#L136) - [coreApiCapabilities/capabilities.feature:175](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiCapabilities/capabilities.feature#L175) -#### [Sharing of project space root via public link does no longer work](https://github.com/owncloud/ocis/issues/6278) +#### [sharing the shares folder to users exits with different status code than in oc10 backend](https://github.com/owncloud/ocis/issues/2215) - [coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature:23](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature#L23) - [coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature:24](https://github.com/owncloud/ocis/blob/master/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature#L24) diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 7fee93c6480..184a8660cb1 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -3345,7 +3345,6 @@ public function userReactsToShareOfferedBy(string $user, string $action, string $url ); $this->pushToLastStatusCodesArrays(); - } /** @@ -3555,7 +3554,7 @@ public function assertNoSharesOfUserAreInState(string $user, string $state):void * @throws JsonException */ public function userHasUnsharedResourceSharedTo(string $sharer, string $path, string $sharee): void { - $this->userUnsharesSharedTo($sharer, $path, $sharee); + $this->userUnsharesResourceSharedTo($sharer, $path, $sharee); $this->ocsContext->assertOCSResponseIndicatesSuccess( 'The ocs share response does not indicate success.', ); @@ -3573,7 +3572,7 @@ public function userHasUnsharedResourceSharedTo(string $sharer, string $path, st * @return void * @throws JsonException */ - public function userUnsharesSharedTo(string $sharer, string $path, string $sharee): void { + public function userUnsharesResourceSharedTo(string $sharer, string $path, string $sharee): void { $sharer = $this->getActualUsername($sharer); $sharee = $this->getActualUsername($sharee); diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 41464b2cb3b..4cd994397d8 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -3334,21 +3334,21 @@ public function theUserShouldNotBeAbleToDeleteEntry(string $user, string $entry, * @return void */ public function fileHasBeenDeleted(string $file, string $user):void { - $this->userHasDeletedFile($user, "deleted", "file", $file); + $this->userHasDeletedResource($user, "deleted", "file", $file); } /** - * @When /^user "([^"]*)" deletes (?:file|folder) "([^"]*)" using the WebDAV API$/ + * @When user :user deletes file/folder :resource using the WebDAV API * * @param string $user - * @param string $file + * @param string $resource * * @return void */ - public function userDeletesFile(string $user, string $file):void { + public function userDeletesFile(string $user, string $resource):void { $user = $this->getActualUsername($user); $this->pauseUploadDelete(); - $this->response = $this->makeDavRequest($user, 'DELETE', $file, []); + $this->response = $this->makeDavRequest($user, 'DELETE', $resource, []); $this->lastUploadDeleteTime = \time(); $this->pushToLastHttpStatusCodesArray((string) $this->getResponse()->getStatusCode()); } @@ -3362,7 +3362,7 @@ public function userDeletesFile(string $user, string $file):void { * @return void * @throws Exception */ - public function userHasDeletedFile(string $user, string $resource):void { + public function userHasDeletedResource(string $user, string $resource):void { $user = $this->getActualUsername($user); $this->userDeletesFile($user, $resource); // If the file or folder was there and got deleted then we get a 204 @@ -3393,7 +3393,7 @@ public function userHasDeletedFollowingFiles(string $user, TableNode $table):voi $paths = $table->getHash(); foreach ($paths as $file) { - $this->userHasDeletedFile($user, $file["path"]); + $this->userHasDeletedResource($user, $file["path"]); } } @@ -3437,7 +3437,7 @@ public function theUserDeletesFile(string $file):void { * @return void */ public function theUserHasDeletedFile(string $fileOrFolder, string $file):void { - $this->userHasDeletedFile($this->getCurrentUser(),$fileOrFolder, $file); + $this->userHasDeletedResource($this->getCurrentUser(), $fileOrFolder, $file); } /** @@ -4499,7 +4499,7 @@ public function userDeletesEverythingInFolder( foreach ($elementList as $element) { $element = \substr((string)$element, \strlen($davPrefix)); if ($checkEachDelete) { - $this->userHasDeletedFile($user, "deleted", "file", $element); + $this->userHasDeletedResource($user, "deleted", "file", $element); } else { $this->userDeletesFile($user, $element); } diff --git a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature index f98b0d1c787..186273c8797 100644 --- a/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature +++ b/tests/acceptance/features/coreApiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature @@ -14,11 +14,11 @@ Feature: shares are received in the default folder for received shares And user "Alice" has created folder "FOLDER" When user "Alice" shares folder "/FOLDER" with user "Brian" using the sharing API And user "Brian" accepts share "/FOLDER" offered by user "Alice" using the sharing API - When user "Brian" declines share "/Shares/FOLDER" offered by user "Alice" using the sharing API + And user "Brian" declines share "/Shares/FOLDER" offered by user "Alice" using the sharing API And user "Brian" shares folder "/Shares" with user "Alice" using the sharing API Then the OCS status code of responses on each endpoint should be "" respectively And the HTTP status code of responses on each endpoint should be "" respectively Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100, 100,100,404 | 200, 200, 200, 200 | - | 2 | 200, 200,200,404 | 200, 200, 200, 400 | + | ocs_api_version | ocs_status_code | http_status_code | + | 1 | 100, 100, 100, 400 | 200, 200, 200, 200 | + | 2 | 200, 200, 200, 400 | 200, 200, 200, 400 | diff --git a/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature b/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature index 0671417a878..0703a74ec19 100644 --- a/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature +++ b/tests/acceptance/features/coreApiShareManagementBasicToShares/deleteShareFromShares.feature @@ -106,8 +106,8 @@ Feature: sharing And user "Carol" has stored etag of element "/PARENT" And user "Brian" has stored etag of element "/" And user "Brian" has stored etag of element "/Shares" - When user "Brian" unshares file "/Shares/parent.txt" using the WebDAV API - Then the HTTP status code should be "204" + When user "Brian" declines share "/Shares/parent.txt" offered by user "Carol" using the sharing API + Then the HTTP status code should be "200" And the etag of element "/" of user "Brian" should have changed And the etag of element "/Shares" of user "Brian" should have changed And the etag of element "/PARENT" of user "Carol" should not have changed @@ -228,13 +228,15 @@ Feature: sharing | 2 | 404 | 404 | - Scenario: unshare a shared resources - Given using OCS API version "1" - And user "Alice" has shared file "textfile0.txt" with user "Brian" - And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice" - When user "Alice" unshares file "textfile0.txt" shared to "Brian" - Then the OCS status code should be "100" - And the HTTP status code should be "200" - And as "Brian" file "/Shares/shared/textfile0.txt" should not exist - - + Scenario Outline: unshare a shared resources + Given using OCS API version "" + And user "Alice" has shared file "textfile0.txt" with user "Brian" + And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice" + When user "Alice" unshares file "textfile0.txt" shared to "Brian" + Then the OCS status code should be "" + And the HTTP status code should be "" + And as "Brian" file "/Shares/textfile0.txt" should not exist + Examples: + | ocs_api_version | ocs_status_code | http_status_code | + | 1 | 100 | 200 | + | 2 | 200 | 200 | diff --git a/tests/acceptance/features/coreApiVersions/fileVersions.feature b/tests/acceptance/features/coreApiVersions/fileVersions.feature index 5ae11ba824b..548df6b2798 100644 --- a/tests/acceptance/features/coreApiVersions/fileVersions.feature +++ b/tests/acceptance/features/coreApiVersions/fileVersions.feature @@ -421,7 +421,7 @@ Feature: dav-versions | new | Brian | /testshare | - Scenario: receiver tries to get file versions of file not shared by the sharer + Scenario: sharee tries to get file versions of file not shared by the sharer Given user "Brian" has been created with default attributes and without skeleton files And user "Alice" has uploaded file with content "textfile0" to "textfile0.txt" And user "Alice" has uploaded file with content "textfile1" to "textfile1.txt"