From d2b6adbbf341e4878fcb07e52e4ef0044b3e2dc4 Mon Sep 17 00:00:00 2001 From: Parajuli Kiran Date: Mon, 28 Mar 2022 14:46:54 +0545 Subject: [PATCH] Addressed reviews Signed-off-by: Parajuli Kiran --- .../createShareExpirationDate.feature | 175 ++++++++---------- .../createShareReceivedInMultipleWays.feature | 30 +-- .../createShareReceivedInMultipleWays.feature | 47 +++-- .../acceptance/features/bootstrap/Sharing.php | 50 +++-- .../acceptance/features/bootstrap/WebDav.php | 1 + 5 files changed, 142 insertions(+), 161 deletions(-) diff --git a/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareExpirationDate.feature b/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareExpirationDate.feature index c5ce4362b8d7..7434a9212145 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareExpirationDate.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareExpirationDate.feature @@ -89,19 +89,17 @@ Feature: a default expiration date can be specified for shares with users or gro | expireDate | +15 days | When the administrator sets parameter "shareapi_default_expire_date_user_share" of app "core" to "no" Then the info about the last share by user "Alice" with user "Brian" should include - | share_type | user | - | file_target | /FOLDER | - | uid_owner | %username% | - | expiration | +15 days | - | share_with | %username% | - | ocs_status_code | | - | http_status_code | | + | share_type | user | + | file_target | /FOLDER | + | uid_owner | %username% | + | expiration | +15 days | + | share_with | %username% | And the response when user "Brian" gets the info of the last share should include | expiration | +15 days | Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100 | 200 | - | 2 | 200 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled and enforced for users, user shares with expiration date and then disables @@ -115,21 +113,19 @@ Feature: a default expiration date can be specified for shares with users or gro | shareType | user | | shareWith | Brian | | permissions | read,share | - When parameter "shareapi_default_expire_date_user_share" of app "core" has been set to "no" + When the administrator sets parameter "shareapi_default_expire_date_user_share" of app "core" to "no" Then the info about the last share by user "Alice" with user "Brian" should include - | share_type | user | - | file_target | /FOLDER | - | uid_owner | %username% | - | share_with | %username% | - | expiration | +7 days | - | ocs_status_code | | - | http_status_code | | + | share_type | user | + | file_target | /FOLDER | + | uid_owner | %username% | + | share_with | %username% | + | expiration | +7 days | And the response when user "Brian" gets the info of the last share should include | expiration | +7 days | Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100 | 200 | - | 2 | 200 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled but not enforced for groups, user shares without specifying expireDate @@ -194,7 +190,7 @@ Feature: a default expiration date can be specified for shares with users or gro | permissions | read,share | | expireDate | +15 days | Then the OCS status code should be "" - And the HTTP status code should be "" + And the HTTP status code should be "200" And the fields of the last response to user "Alice" sharing with group "grp1" should include | share_type | group | | file_target | /FOLDER | @@ -204,9 +200,9 @@ Feature: a default expiration date can be specified for shares with users or gro And the response when user "Brian" gets the info of the last share should include | expiration | +15 days | Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100 | 200 | - | 2 | 200 | 200 | + | ocs_api_version | ocs_status_code | + | 1 | 100 | + | 2 | 200 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled but not enforced for groups, user shares with expiration date and then disables @@ -224,19 +220,17 @@ Feature: a default expiration date can be specified for shares with users or gro | expireDate | +15 days | When the administrator sets parameter "shareapi_default_expire_date_group_share" of app "core" to "no" Then the info about the last share by user "Alice" with group "grp1" should include - | share_type | group | - | file_target | /FOLDER | - | uid_owner | %username% | - | share_with | grp1 | - | expiration | +15 days | - | ocs_status_code | | - | http_status_code | | + | share_type | group | + | file_target | /FOLDER | + | uid_owner | %username% | + | share_with | grp1 | + | expiration | +15 days | And the response when user "Brian" gets the info of the last share should include | expiration | +15 days | Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100 | 200 | - | 2 | 200 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled and enforced for groups, user shares with expiration date and then disables @@ -255,19 +249,17 @@ Feature: a default expiration date can be specified for shares with users or gro | expireDate | +3 days | When the administrator sets parameter "shareapi_default_expire_date_group_share" of app "core" to "no" Then the info about the last share by user "Alice" with group "grp1" should include - | share_type | group | - | file_target | /FOLDER | - | uid_owner | %username% | - | share_with | grp1 | - | expiration | +3 days | - | ocs_status_code | | - | http_status_code | | + | share_type | group | + | file_target | /FOLDER | + | uid_owner | %username% | + | share_with | grp1 | + | expiration | +3 days | And the response when user "Brian" gets the info of the last share should include | expiration | +3 days | Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100 | 200 | - | 2 | 200 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled and enforced for users, user shares without setting expiration date @@ -278,7 +270,7 @@ Feature: a default expiration date can be specified for shares with users or gro And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" When user "Alice" shares file "textfile0.txt" with user "Brian" using the sharing API Then the OCS status code should be "" - And the HTTP status code should be "" + And the HTTP status code should be "200" And the fields of the last response to user "Alice" sharing with user "Brian" should include | share_type | user | | file_target | /textfile0.txt | @@ -288,9 +280,9 @@ Feature: a default expiration date can be specified for shares with users or gro And the response when user "Brian" gets the info of the last share should include | expiration | +7 days | Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 100 | 200 | - | 2 | 200 | 200 | + | ocs_api_version | ocs_status_code | + | 1 | 100 | + | 2 | 200 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled and enforced for users, user shares with expiration date more than the default @@ -372,13 +364,11 @@ Feature: a default expiration date can be specified for shares with users or gro And user "Alice" has shared file "textfile0.txt" with user "Brian" with permissions "read,share" When the administrator sets parameter "shareapi_expire_after_n_days_user_share" of app "core" to "40" Then the info about the last share by user "Alice" with user "Brian" should include - | expiration | +30 days | - | http_status_code | 200 | - | ocs_status_code | | + | expiration | +30 days | Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled for users/max expire date is set, user shares and changes max expire date less than the previous one @@ -391,13 +381,11 @@ Feature: a default expiration date can be specified for shares with users or gro And user "Alice" has shared file "textfile0.txt" with user "Brian" with permissions "read,share" When the administrator sets parameter "shareapi_expire_after_n_days_user_share" of app "core" to "15" Then the info about the last share by user "Alice" with user "Brian" should include - | expiration | +30 days | - | http_status_code | 200 | - | ocs_status_code | | + | expiration | +30 days | Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled and enforced for groups, user shares without setting expiration date @@ -512,15 +500,13 @@ Feature: a default expiration date can be specified for shares with users or gro And user "Alice" has shared file "textfile0.txt" with group "grp1" with permissions "read,share" When the administrator sets parameter "shareapi_expire_after_n_days_group_share" of app "core" to "40" Then the info about the last share by user "Alice" with user "Brian" should include - | expiration | +30 days | - | http_status_code | 200 | - | ocs_status_code | | + | expiration | +30 days | And the response when user "Brian" gets the info of the last share should include | expiration | +30 days | Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enabled for groups/max expire date is set, user shares and changes max expire date less than the previous one @@ -534,17 +520,14 @@ Feature: a default expiration date can be specified for shares with users or gro And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" And user "Alice" has shared file "textfile0.txt" with group "grp1" with permissions "read,share" When the administrator sets parameter "shareapi_expire_after_n_days_group_share" of app "core" to "15" - And user "Alice" gets the info of the last share using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" - And the fields of the last response to user "Alice" should include + Then the response when user "Alice" gets the info of the last share should include | expiration | +30 days | And the response when user "Brian" gets the info of the last share should include | expiration | +30 days | Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enforced for users, user shares to a group without setting an expiration date @@ -557,15 +540,13 @@ Feature: a default expiration date can be specified for shares with users or gro And user "Alice" has created folder "FOLDER" When user "Alice" shares file "FOLDER" with group "grp1" with permissions "read,share" using the sharing API Then the info about the last share by user "Alice" with group "grp1" should include - | expiration | | - | http_status_code | 200 | - | ocs_status_code | | + | expiration | | And the response when user "Brian" gets the info of the last share should include | expiration | | Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enforced for groups, user shares to another user @@ -576,15 +557,13 @@ Feature: a default expiration date can be specified for shares with users or gro And user "Alice" has created folder "FOLDER" When user "Alice" shares file "/FOLDER" with user "Brian" with permissions "read,share" using the sharing API Then the info about the last share by user "Alice" with user "Brian" should include - | expiration | | - | http_status_code | 200 | - | ocs_status_code | | + | expiration | | And the response when user "Brian" gets the info of the last share should include | expiration | | Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enforced for users, user shares with invalid expiration date set @@ -708,17 +687,17 @@ Feature: a default expiration date can be specified for shares with users or gro | permissions | read,share | | expireDateAsString | 123 | Then the HTTP status code should be "" - And the OCS status code should be "" + And the OCS status code should be "404" And the OCS status message should be "Invalid date, date format must be YYYY-MM-DD" And user "Brian" should not have any received shares Examples: - | ocs_api_version | ocs_status_code | http_status_code | default | enforce | - | 1 | 404 | 200 | yes | yes | - | 2 | 404 | 404 | yes | yes | - | 1 | 404 | 200 | yes | no | - | 2 | 404 | 404 | yes | no | - | 1 | 404 | 200 | no | no | - | 2 | 404 | 404 | no | no | + | ocs_api_version | http_status_code | default | enforce | + | 1 | 200 | yes | yes | + | 2 | 404 | yes | yes | + | 1 | 200 | yes | no | + | 2 | 404 | yes | no | + | 1 | 200 | no | no | + | 2 | 404 | no | no | @skipOnOcV10.3 Scenario Outline: sharing with default expiration date enforced for users, user shares with past expiration date set @@ -734,13 +713,13 @@ Feature: a default expiration date can be specified for shares with users or gro | permissions | read,share | | expireDateAsString | -10 days | Then the HTTP status code should be "" - And the OCS status code should be "" + And the OCS status code should be "404" And the OCS status message should be "Expiration date is in the past" And user "Brian" should not have any received shares Examples: - | ocs_api_version | ocs_status_code | http_status_code | - | 1 | 404 | 200 | - | 2 | 404 | 404 | + | ocs_api_version | http_status_code | + | 1 | 200 | + | 2 | 404 | @skipOnOcV10.3 @issue-36569 Scenario Outline: sharing with default expiration date enforced for users, max expire date is 0, user shares without specifying expiration date diff --git a/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareReceivedInMultipleWays.feature b/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareReceivedInMultipleWays.feature index b5efb1cedd12..ea939f615b8c 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareReceivedInMultipleWays.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToRoot1/createShareReceivedInMultipleWays.feature @@ -100,20 +100,16 @@ Feature: share resources where the sharee receives the share in multiple ways And user "Brian" has uploaded file with content "First data" to "/randomfile.txt" And user "Carol" has uploaded file with content "Second data" to "/randomfile.txt" When user "Brian" shares file "randomfile.txt" with user "Alice" with permissions "read" using the sharing API - And user "Alice" gets the info of the last share using the sharing API - Then the OCS status code of responses on all endpoints should be "" - And the HTTP status code of responses on all endpoints should be "200" - And the fields of the last response about user "Brian" sharing with user "Alice" should include + Then the OCS status code should be "" + And the HTTP status code should be "200" + And as "Alice" the info about the last share by user "Brian" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | /randomfile.txt | | item_type | file | | permissions | read | When user "Carol" shares file "randomfile.txt" with user "Alice" with permissions "read,update" using the sharing API - And user "Alice" gets the info of the last share using the sharing API - Then the OCS status code of responses on all endpoints should be "" - And the HTTP status code of responses on all endpoints should be "200" - And the fields of the last response about user "Carol" sharing with user "Alice" should include + And as "Alice" the info about the last share by user "Carol" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | /randomfile (2).txt | @@ -138,20 +134,14 @@ Feature: share resources where the sharee receives the share in multiple ways And user "Carol" has created folder "/zzzfolder" And user "Carol" has created folder "zzzfolder/Carol" When user "Brian" shares folder "zzzfolder" with user "Alice" with permissions "read,delete" using the sharing API - And user "Alice" gets the info of the last share using the sharing API - Then the OCS status code of responses on all endpoints should be "" - And the HTTP status code of responses on all endpoints should be "200" - And the fields of the last response about user "Brian" sharing with user "Alice" should include + And as "Alice" the info about the last share by user "Brian" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | /zzzfolder | | item_type | folder | | permissions | read,delete | When user "Carol" shares folder "zzzfolder" with user "Alice" with permissions "read,share" using the sharing API - And user "Alice" gets the info of the last share using the sharing API - Then the OCS status code of responses on all endpoints should be "" - And the HTTP status code of responses on all endpoints should be "200" - And the fields of the last response about user "Carol" sharing with user "Alice" should include + And as "Alice" the info about the last share by user "Carol" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | /zzzfolder (2) | @@ -160,9 +150,9 @@ Feature: share resources where the sharee receives the share in multiple ways And as "Alice" folder "zzzfolder/Brian" should exist And as "Alice" folder "zzzfolder (2)/Carol" should exist Examples: - | ocs_api_version | ocs_status_code | - | 1 | 100 | - | 2 | 200 | + | ocs_api_version | + | 1 | + | 2 | @skipOnEncryptionType:user-keys @encryption-issue-132 @skipOnLDAP Scenario Outline: share with a group and then add a user to that group that already has a file with the shared name @@ -187,4 +177,4 @@ Feature: share resources where the sharee receives the share in multiple ways Examples: | ocs_api_version | ocs_status_code | | 1 | 100 | - | 2 | 200 | \ No newline at end of file + | 2 | 200 | diff --git a/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareReceivedInMultipleWays.feature b/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareReceivedInMultipleWays.feature index 94647ea0c5ee..dce1f72a89e2 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareReceivedInMultipleWays.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToShares1/createShareReceivedInMultipleWays.feature @@ -134,7 +134,7 @@ Feature: share resources where the sharee receives the share in multiple ways And user "Carol" has uploaded file with content "Second data" to "/randomfile.txt" When user "Brian" shares file "randomfile.txt" with user "Alice" with permissions "read" using the sharing API And user "Alice" accepts share "/randomfile.txt" offered by user "Brian" using the sharing API - Then the info about the last share by user "Brian" with user "Alice" should include + Then as "Alice" the info about the last share by user "Brian" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | | @@ -142,7 +142,7 @@ Feature: share resources where the sharee receives the share in multiple ways | permissions | read | When user "Carol" shares file "randomfile.txt" with user "Alice" with permissions "read,update" using the sharing API And user "Alice" accepts share "/randomfile.txt" offered by user "Carol" using the sharing API - Then the info about the last share by user "Carol" with user "Alice" should include + Then as "Alice" the info about the last share by user "Carol" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | | @@ -172,7 +172,7 @@ Feature: share resources where the sharee receives the share in multiple ways And user "Carol" has created folder "zzzfolder/Carol" When user "Brian" shares folder "zzzfolder" with user "Alice" with permissions "read,delete" using the sharing API And user "Alice" accepts share "/zzzfolder" offered by user "Brian" using the sharing API - Then the info about the last share by user "Brian" with user "Alice" should include + Then as "Alice" the info about the last share by user "Brian" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | | @@ -180,7 +180,7 @@ Feature: share resources where the sharee receives the share in multiple ways | permissions | read,delete | When user "Carol" shares folder "zzzfolder" with user "Alice" with permissions "read,share" using the sharing API And user "Alice" accepts share "/zzzfolder" offered by user "Carol" using the sharing API - Then the info about the last share by user "Carol" with user "Alice" should include + Then as "Alice" the info about the last share by user "Carol" with user "Alice" should include | uid_owner | %username% | | share_with | %username% | | file_target | | @@ -258,9 +258,10 @@ Feature: share resources where the sharee receives the share in multiple ways And as "Brian" folder "/Shares/child1" should exist When user "Brian" creates folder "/Shares/child1/fo3" using the WebDAV API Then the HTTP status code should be "403" - And as "Alice" folder "/Shares/child1" should exist + And as "Alice" folder "/Shares/child1/fo3" should not exist When user "Alice" creates folder "/Shares/child1/fo3" using the WebDAV API Then the HTTP status code should be "403" + And as "Alice" folder "/Shares/child1/fo3" should not exist @skipOnOcV10.6 @skipOnOcV10.7 @skipOnOcV10.8.0 @issue-2440 Examples: | path | @@ -299,11 +300,15 @@ Feature: share resources where the sharee receives the share in multiple ways When user "Brian" moves file "/Shares/parent/child1/child2/textfile-2.txt" to "/Shares/parent/child1/child2/rename.txt" using the WebDAV API Then the HTTP status code should be "201" And as "Brian" file "/Shares/child1/child2/rename.txt" should exist + But as "Brian" file "/Shares/child1/child2/textfile-2.txt" should not exist When user "Brian" moves file "/Shares/child1/child2/rename.txt" to "/Shares/child1/child2/rename2.txt" using the WebDAV API Then the HTTP status code should be "403" And as "Alice" file "/Shares/child1/child2/rename.txt" should exist + But as "Alice" file "/Shares/child1/child2/rename2.txt" should not exist When user "Alice" moves file "/Shares/child1/child2/rename.txt" to "/Shares/child1/child2/rename2.txt" using the WebDAV API Then the HTTP status code should be "403" + And as "Alice" file "/Shares/child1/child2/rename2.txt" should not exist + But as "Alice" file "/Shares/child1/child2/rename.txt" should exist @skipOnOcV10.6 @skipOnOcV10.7 @skipOnOcV10.8.0 @issue-2440 Examples: | path | @@ -348,6 +353,7 @@ Feature: share resources where the sharee receives the share in multiple ways And as "Alice" folder "/Shares/child1" should exist When user "Alice" deletes folder "/Shares/child1/child2" using the WebDAV API Then the HTTP status code should be "403" + And as "Alice" folder "/Shares/child1/child2" should exist @skipOnOcV10.6 @skipOnOcV10.7 @skipOnOcV10.8.0 @issue-2440 Examples: | path | @@ -389,9 +395,7 @@ Feature: share resources where the sharee receives the share in multiple ways | permissions | read | Then the HTTP status code should be "200" And the OCS status code should be "100" - When user "Alice" accepts share "/parent" offered by user "Brian" using the sharing API - And the HTTP status code should be "200" - And the OCS status code should be "100" + And user "Alice" should be able to accept pending share "/parent" offered by user "Brian" And as "Brian" folder "/Shares/child1" should exist And as "Alice" folder "/Shares/child1" should exist And as "Alice" folder "/Shares/parent" should exist @@ -426,23 +430,16 @@ Feature: share resources where the sharee receives the share in multiple ways | shareType | user | | shareWith | Brian | | permissions | all | - And user "Brian" has accepted share "" offered by user "Carol" - And user "Brian" has accepted share "/parent" offered by user "Carol" - And user "Alice" has accepted share "/parent" offered by user "Carol" - When user "Brian" creates folder "/Shares/child1/fo1" using the WebDAV API - Then the HTTP status code should be "201" - And as "Brian" folder "/Shares/child1/fo1" should exist - When user "Brian" creates folder "/Shares/child1/child2/fo2" using the WebDAV API - Then the HTTP status code should be "201" - And as "Brian" folder "/Shares/child1/child2/fo2" should exist - And as "Brian" folder "/Shares/parent" should exist - When user "Brian" creates folder "/Shares/parent/fo3" using the WebDAV API - Then the HTTP status code should be "403" - And as "Brian" folder "/Shares/parent/fo3" should not exist - And as "Alice" folder "/Shares/parent" should exist - When user "Alice" creates folder "/Shares/parent/fo3" using the WebDAV API - Then the HTTP status code should be "403" - And as "Alice" folder "/Shares/parent/fo3" should not exist + When user "Brian" accepts share "" offered by user "Carol" using the sharing API + And user "Brian" accepts share "/parent" offered by user "Carol" using the sharing API + And user "Alice" accepts share "/parent" offered by user "Carol" 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" + And user "Brian" should be able to create folder "/Shares/child1/fo1" + And user "Brian" should be able to create folder "/Shares/child1/child2/fo2" + But user "Brian" should not be able to create folder "/Shares/parent/fo3" + And user "Brian" should not be able to create folder "/Shares/parent/fo3" + And user "Alice" should not be able to create folder "/Shares/parent/fo3" @skipOnOcV10.6 @skipOnOcV10.7 @skipOnOcV10.8.0 Examples: | path | diff --git a/tests/acceptance/features/bootstrap/Sharing.php b/tests/acceptance/features/bootstrap/Sharing.php index 257a54ee6d20..70189cb0e513 100644 --- a/tests/acceptance/features/bootstrap/Sharing.php +++ b/tests/acceptance/features/bootstrap/Sharing.php @@ -1920,10 +1920,31 @@ public function userGetsInfoOfLastShareUsingTheSharingApi(string $user, ?string } /** - * @Then /^the info about the last share by user "([^"]*)" with (user|group) "([^"]*)" should include$/ + * @Then /^as "([^"]*)" the info about the last share by user "([^"]*)" with user "([^"]*)" should include$/ + * + * @param string $requestor + * @param string $sharer + * @param string $sharee + * @param TableNode $table + * + * @return void + * @throws Exception + */ + public function asLastShareInfoAboutUserSharingWithUserShouldInclude( + string $requestor, + string $sharer, + string $sharee, + TableNode $table + ) { + $this->userGetsInfoOfLastShareUsingTheSharingApi($requestor); + $this->ocsContext->assertOCSResponseIndicatesSuccess(); + $this->checkFieldsOfLastResponseToUser($sharer, $sharee, $table); + } + + /** + * @Then /^the info about the last share by user "([^"]*)" with (?:user|group) "([^"]*)" should include$/ * * @param string $sharer - * @param string $userOrGroup * @param string $sharee * @param TableNode $table * @@ -1932,24 +1953,10 @@ public function userGetsInfoOfLastShareUsingTheSharingApi(string $user, ?string */ public function theInfoAboutTheLastShareByUserWithUserShouldInclude( string $sharer, - string $userOrGroup, string $sharee, TableNode $table ):void { - $this->userGetsInfoOfLastShareUsingTheSharingApi($sharer); - $rows = $table->getRows(); - $infoTable = []; - for ($index = 0; $index < \count($rows); $index++) { - if ($rows[$index][0] === "ocs_status_code") { - $this->ocsContext->theOCSStatusCodeShouldBe($rows[$index][1]); - } elseif ($rows[$index][0] === "http_status_code") { - $this->thenTheHTTPStatusCodeShouldBe($rows[$index][1]); - } else { - $infoTable[$index] = $rows[$index]; - } - } - $table = new TableNode($infoTable); - $this->checkFieldsOfLastResponseToUser($sharer, $sharee, $table); + $this->asLastShareInfoAboutUserSharingWithUserShouldInclude($sharer, $sharer, $sharee, $table); } /** @@ -2275,6 +2282,13 @@ public function theResponseWhenUserGetsInfoOfLastShareShouldInclude( 200, "Error getting info of last share for user $user" ); + $this->ocsContext->assertOCSResponseIndicatesSuccess( + __METHOD__ . + ' Error getting info of last share for user $user\n' . + $this->ocsContext->getOCSResponseStatusMessage( + $this->getResponse() + ) . '"' + ); $this->checkFields($user, $body); } @@ -2286,7 +2300,6 @@ public function theResponseWhenUserGetsInfoOfLastShareShouldInclude( * * @return void * @throws Exception - * */ public function informationOfLastShareShouldInclude( string $user, @@ -3132,6 +3145,7 @@ public function userHasAcceptedThePendingShareOfferedBy($user, $share, $offeredB 200, __METHOD__ . " could not accept the pending share $share to $user by $offeredBy" ); + $this->ocsContext->assertOCSResponseIndicatesSuccess(); } /** diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index c5ca4891ee01..d75068849430 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -2074,6 +2074,7 @@ public function userHasUploadedAFileTo(string $user, string $source, string $des "HTTP status code was not 201 or 204 while trying to upload file '$source' to '$destination' for user '$user'" ); $this->emptyLastHTTPStatusCodesArray(); + $this->emptyLastOCSStatusCodesArray(); } /**