From 825501fc9d2efbf7af894dbdf094c21030bd810d Mon Sep 17 00:00:00 2001 From: Parajuli Kiran Date: Fri, 22 Apr 2022 14:19:55 +0545 Subject: [PATCH 1/2] Improve then steps for suite 'apiFederationToShares1' Signed-off-by: Parajuli Kiran Signed-off-by: Kiran Parajuli --- .../etagPropagation.feature | 3 +- .../apiFederationToShares1/federated.feature | 28 +++++++++++-------- .../savePublicShare.feature | 6 ++-- .../acceptance/features/bootstrap/Sharing.php | 7 +++-- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/tests/acceptance/features/apiFederationToShares1/etagPropagation.feature b/tests/acceptance/features/apiFederationToShares1/etagPropagation.feature index 0bd0c2c62237..e6ccb3287683 100644 --- a/tests/acceptance/features/apiFederationToShares1/etagPropagation.feature +++ b/tests/acceptance/features/apiFederationToShares1/etagPropagation.feature @@ -20,7 +20,8 @@ Feature: propagation of etags between federated and local server And user "Alice" has stored etag of element "/Shares/PARENT" And using server "LOCAL" When user "Brian" uploads file "filesForUpload/file_to_overwrite.txt" to "/PARENT/textfile0.txt" using the WebDAV API - Then the etag of element "/Shares/PARENT" of user "Alice" on server "REMOTE" should have changed + Then the HTTP status code should be "201" + And the etag of element "/Shares/PARENT" of user "Alice" on server "REMOTE" should have changed @issue-enterprise-2848 Scenario: Overwrite a federated shared folder as sharer propagates etag to root folder for recipient diff --git a/tests/acceptance/features/apiFederationToShares1/federated.feature b/tests/acceptance/features/apiFederationToShares1/federated.feature index ec9f481f7780..709c0db8c864 100644 --- a/tests/acceptance/features/apiFederationToShares1/federated.feature +++ b/tests/acceptance/features/apiFederationToShares1/federated.feature @@ -543,16 +543,18 @@ Feature: federated And user "Brian" has created folder "/zzzfolder" And user "Brian" has created folder "zzzfolder/local" And user "Brian" has uploaded file with content "local content" to "/randomfile.txt" - When user "Alice" from server "REMOTE" shares "zzzfolder" with user "Carol" from server "LOCAL" using the sharing API + And user "Alice" from server "REMOTE" has shared "zzzfolder" with user "Carol" from server "LOCAL" + And user "Alice" from server "REMOTE" has shared "randomfile.txt" with user "Carol" from server "LOCAL" + And user "Brian" has shared folder "zzzfolder" with user "Carol" + And user "Brian" has shared folder "randomfile.txt" with user "Carol" + When user "Carol" from server "LOCAL" accepts the last pending share using the sharing API And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API - And user "Alice" from server "REMOTE" shares "randomfile.txt" with user "Carol" from server "LOCAL" using the sharing API - And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API - And user "Brian" shares folder "zzzfolder" with user "Carol" using the sharing API And user "Carol" accepts share "/zzzfolder" offered by user "Brian" using the sharing API - And user "Brian" shares folder "randomfile.txt" with user "Carol" using the sharing API And user "Carol" accepts share "/randomfile.txt" offered by user "Brian" using the sharing API + Then the HTTP status code of responses on all endpoints should be "200" + And the OCS status code of responses on all endpoints should be "100" # local shares are taking priority at the moment - Then as "Carol" folder "/Shares/zzzfolder/remote" should exist + And as "Carol" folder "/Shares/zzzfolder/remote" should exist And as "Carol" folder "/Shares/zzzfolder (2)/local" should exist And the content of file "/Shares/randomfile.txt" for user "Carol" on server "LOCAL" should be "remote content" And the content of file "/Shares/randomfile (2).txt" for user "Carol" on server "LOCAL" should be "local content" @@ -568,15 +570,17 @@ Feature: federated And user "Brian" has created folder "/zzzfolder" And user "Brian" has created folder "zzzfolder/local" And user "Brian" has uploaded file with content "local content" to "/randomfile.txt" - When user "Brian" shares folder "zzzfolder" with user "Carol" using the sharing API - And user "Carol" accepts share "/zzzfolder" offered by user "Brian" using the sharing API - And user "Brian" shares folder "randomfile.txt" with user "Carol" using the sharing API + And user "Brian" has shared folder "zzzfolder" with user "Carol" + And user "Brian" has shared folder "randomfile.txt" with user "Carol" + And user "Alice" from server "REMOTE" has shared "zzzfolder" with user "Carol" from server "LOCAL" + And user "Alice" from server "REMOTE" has shared "randomfile.txt" with user "Carol" from server "LOCAL" + When user "Carol" accepts share "/zzzfolder" offered by user "Brian" using the sharing API And user "Carol" accepts share "/randomfile.txt" offered by user "Brian" using the sharing API - And user "Alice" from server "REMOTE" shares "zzzfolder" with user "Carol" from server "LOCAL" using the sharing API And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API - And user "Alice" from server "REMOTE" shares "randomfile.txt" with user "Carol" from server "LOCAL" using the sharing API And user "Carol" from server "LOCAL" accepts the last pending share using the sharing API - Then as "Carol" folder "Shares/zzzfolder/local" should exist + Then the HTTP status code of responses on all endpoints should be "200" + And the OCS status code of responses on all endpoints should be "100" + And as "Carol" folder "Shares/zzzfolder/local" should exist And as "Carol" folder "Shares/zzzfolder (2)/remote" should exist And the content of file "/Shares/randomfile.txt" for user "Carol" on server "LOCAL" should be "local content" And the content of file "/Shares/randomfile (2).txt" for user "Carol" on server "LOCAL" should be "remote content" diff --git a/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature b/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature index b5ab420469cb..7c794388b45c 100644 --- a/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature +++ b/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature @@ -42,6 +42,7 @@ Feature: Save public shares created by oC users And user "Brian" has added the public share created from server "LOCAL" using the sharing API When user "Alice" deletes public link share named "sharedlink" in file "/PARENT" using the sharing API Then the HTTP status code should be "200" + And the OCS status code should be "100" And as "Brian" folder "/Shares/PARENT" should not exist @@ -104,7 +105,8 @@ Feature: Save public shares created by oC users And user "Alice" has added the public share created from server "REMOTE" using the sharing API And using server "REMOTE" When user "RemoteAlice" deletes public link share named "sharedlink" in file "/PARENT" using the sharing API - And using server "LOCAL" + Then the HTTP status code should be "200" + When using server "LOCAL" Then as "Alice" folder "/Shares/PARENT" should not exist @@ -125,4 +127,4 @@ Feature: Save public shares created by oC users Examples: | ocs_api_version | http_status_code | | 1 | 200 | - | 2 | 404 | \ No newline at end of file + | 2 | 404 | diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 778de263b1ad..8e2661cffee3 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -389,8 +389,7 @@ public function userHasCreatedAPublicLinkShareWithSettings(string $user, ?TableN $this->userCreatesAPublicLinkShareWithSettings($user, $body); $this->ocsContext->theOCSStatusCodeShouldBe("100,200"); $this->theHTTPStatusCodeShouldBe(200); - $this->emptyLastHTTPStatusCodesArray(); - $this->emptyLastOCSStatusCodesArray(); + $this->clearStatusCodeArrays(); } /** @@ -1439,6 +1438,7 @@ public function userSharesTheFollowingFilesWithUserUsingTheSharingApi( * @param string|int|string[]|int[] $permissions * * @return void + * @throws Exception */ public function userHasSharedFileWithUserUsingTheSharingApi( string $user1, @@ -1455,6 +1455,9 @@ public function userHasSharedFileWithUserUsingTheSharingApi( $permissions, true ); + $this->ocsContext->assertOCSResponseIndicatesSuccess( + 'The ocs share response does not indicate success.', + ); // this is expected to fail if a file is shared with create and delete permissions, which is not possible Assert::assertTrue( $this->isUserOrGroupInSharedData($user2, "user", $permissions), From 1e0a072f59d2609df6a3362ccfc96772545b2465 Mon Sep 17 00:00:00 2001 From: Kiran Parajuli Date: Wed, 27 Apr 2022 17:19:18 +0545 Subject: [PATCH 2/2] Added ocs status code assertion Signed-off-by: Kiran Parajuli --- .../features/apiFederationToShares1/savePublicShare.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature b/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature index 7c794388b45c..3d7c5063c30c 100644 --- a/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature +++ b/tests/acceptance/features/apiFederationToShares1/savePublicShare.feature @@ -106,6 +106,7 @@ Feature: Save public shares created by oC users And using server "REMOTE" When user "RemoteAlice" deletes public link share named "sharedlink" in file "/PARENT" using the sharing API Then the HTTP status code should be "200" + And the OCS status code should be "100" When using server "LOCAL" Then as "Alice" folder "/Shares/PARENT" should not exist