From e3e3d5597118d824ad3f891f56030dacaf7b810a Mon Sep 17 00:00:00 2001 From: sushmita56 Date: Tue, 26 Apr 2022 14:35:02 +0545 Subject: [PATCH] improved then steps --- ...hareDefaultFolderForReceivedShares.feature | 10 ++--- ...reateShareGroupAndUserWithSameName.feature | 32 ++++++--------- .../createShareGroupCaseSensitive.feature | 40 ++++++------------- ...eWhenShareWithOnlyMembershipGroups.feature | 32 ++++++--------- .../acceptance/features/bootstrap/WebDav.php | 2 +- 5 files changed, 42 insertions(+), 74 deletions(-) diff --git a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature index e5ae911437f6..0e4ee9ddcf8c 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareDefaultFolderForReceivedShares.feature @@ -15,9 +15,9 @@ Feature: shares are received in the default folder for received shares 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 And user "Brian" shares folder "/Shares" with user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" + 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 | 404 | 200 | - | 2 | 404 | 404 | + | ocs_api_version | ocs_status_code | http_status_code | + | 1 | 100, 100, 404 | 200, 200, 204, 200 | + | 2 | 200, 200, 404 | 200, 200,204, 404 | diff --git a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupAndUserWithSameName.feature b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupAndUserWithSameName.feature index f5636529496d..1fd87ade325d 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupAndUserWithSameName.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupAndUserWithSameName.feature @@ -18,11 +18,9 @@ Feature: sharing works when a username and group name are the same And user "Alice" has shared file "randomfile.txt" with group "Brian" And user "Carol" has accepted share "/randomfile.txt" offered by user "Alice" When user "Alice" shares file "randomfile.txt" with user "Brian" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" - When user "Brian" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" + And user "Brian" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API + Then the OCS status code of responses on all endpoints should be "100" + And the HTTP status code of responses on all endpoints should be "200" And user "Brian" should see the following elements | /Shares/randomfile.txt | And user "Carol" should see the following elements @@ -42,11 +40,9 @@ Feature: sharing works when a username and group name are the same And user "Alice" has shared file "randomfile.txt" with user "Brian" And user "Brian" has accepted share "/randomfile.txt" offered by user "Alice" When user "Alice" shares file "randomfile.txt" with group "Brian" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" - When user "Carol" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" + And user "Carol" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API + Then the OCS status code of responses on all endpoints should be "100" + And the HTTP status code of responses on all endpoints should be "200" And user "Brian" should see the following elements | /Shares/randomfile.txt | And user "Carol" should see the following elements @@ -66,11 +62,9 @@ Feature: sharing works when a username and group name are the same And user "Alice" has shared file "randomfile.txt" with group "brian" And user "Carol" has accepted share "/randomfile.txt" offered by user "Alice" When user "Alice" shares file "randomfile.txt" with user "Brian" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" - When user "Brian" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" + And user "Brian" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API + Then the OCS status code of responses on all endpoints should be "100" + And the HTTP status code of responses on all endpoints should be "200" And user "Brian" should see the following elements | /Shares/randomfile.txt | And user "Carol" should see the following elements @@ -90,11 +84,9 @@ Feature: sharing works when a username and group name are the same And user "Alice" has shared file "randomfile.txt" with user "Brian" And user "Brian" has accepted share "/randomfile.txt" offered by user "Alice" When user "Alice" shares file "randomfile.txt" with group "brian" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" - When user "Carol" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "100" - And the HTTP status code should be "200" + And user "Carol" accepts share "/randomfile.txt" offered by user "Alice" using the sharing API + Then the OCS status code of responses on all endpoints should be "100" + And the HTTP status code of responses on all endpoints should be "200" And user "Carol" should see the following elements | /Shares/randomfile.txt | And user "Brian" should see the following elements diff --git a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature index 61bed5775325..3a054cfaad0f 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareGroupCaseSensitive.feature @@ -24,25 +24,15 @@ Feature: share with groups, group names are case-sensitive And user "Carol" has been added to group "" And user "David" has been added to group "" When user "Alice" shares file "textfile1.txt" with group "" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" - When user "Brian" accepts share "/textfile1.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" - And the content of file "/Shares/textfile1.txt" for user "Brian" should be "ownCloud test text file 1" + And user "Brian" accepts share "/textfile1.txt" offered by user "Alice" using the sharing API + Then the content of file "/Shares/textfile1.txt" for user "Brian" should be "ownCloud test text file 1" When user "Alice" shares file "textfile2.txt" with group "" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" - When user "Carol" accepts share "/textfile2.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" - And the content of file "/Shares/textfile2.txt" for user "Carol" should be "ownCloud test text file 2" + And user "Carol" accepts share "/textfile2.txt" offered by user "Alice" using the sharing API + Then the content of file "/Shares/textfile2.txt" for user "Carol" should be "ownCloud test text file 2" When user "Alice" shares file "textfile3.txt" with group "" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" - When user "David" accepts share "/textfile3.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" + And user "David" accepts share "/textfile3.txt" offered by user "Alice" 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 content of file "/Shares/textfile3.txt" for user "David" should be "ownCloud test text file 3" Examples: | ocs_api_version | group_id1 | group_id2 | group_id3 | ocs_status_code | @@ -62,12 +52,8 @@ Feature: share with groups, group names are case-sensitive And group "" has been created And user "Brian" has been added to group "" When user "Alice" shares file "textfile1.txt" with group "" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "200" - When user "Brian" accepts share "/textfile1.txt" offered by user "Alice" 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 + And user "Brian" accepts share "/textfile1.txt" offered by user "Alice" using the sharing API + Then the fields of the last response to user "Alice" should include | share_with | | | file_target | /Shares/textfile1.txt | | path | /Shares/textfile1.txt | @@ -75,11 +61,9 @@ Feature: share with groups, group names are case-sensitive | uid_owner | %username% | And the content of file "/Shares/textfile1.txt" for user "Brian" should be "ownCloud test text file 1" When user "Alice" shares file "textfile2.txt" with group "" using the sharing API - Then the OCS status code should be "404" - And the HTTP status code should be "" - When user "Alice" shares file "textfile3.txt" with group "" using the sharing API - Then the OCS status code should be "404" - And the HTTP status code should be "" + And user "Alice" shares file "textfile3.txt" with group "" using the sharing API + Then the OCS status code of responses on each endpoint should be ", , 404, 404" respectively + And the HTTP status code of responses on each endpoint should be "200, 200, , " respectively Examples: | ocs_api_version | group_id1 | group_id2 | group_id3 | ocs_status_code | http_status_code | | 1 | case-sensitive-group | Case-Sensitive-Group | CASE-SENSITIVE-GROUP | 100 | 200 | diff --git a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareWhenShareWithOnlyMembershipGroups.feature b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareWhenShareWithOnlyMembershipGroups.feature index 22ffd82afb0d..f0b949153355 100644 --- a/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareWhenShareWithOnlyMembershipGroups.feature +++ b/tests/acceptance/features/apiShareCreateSpecialToShares2/createShareWhenShareWithOnlyMembershipGroups.feature @@ -36,11 +36,9 @@ Feature: cannot share resources outside the group when share with membership gro And user "Alice" has been added to group "grp0" And user "Alice" has created folder "PARENT" When user "Alice" shares folder "/PARENT" with user "Brian" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" - When user "Brian" accepts share "/PARENT" offered by user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" + And user "Brian" accepts share "/PARENT" offered by user "Alice" 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 "" And as "Brian" folder "/Shares/PARENT" should exist But as "Brian" folder "/PARENT" should not exist Examples: @@ -58,11 +56,9 @@ Feature: cannot share resources outside the group when share with membership gro And user "Brian" has been added to group "grp0" And user "Alice" has created folder "PARENT" When user "Alice" shares folder "/PARENT" with group "grp0" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" - When user "Brian" accepts share "/PARENT" offered by user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" + And user "Brian" accepts share "/PARENT" offered by user "Alice" 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 "" And as "Brian" folder "/Shares/PARENT" should exist But as "Brian" folder "/PARENT" should not exist Examples: @@ -101,11 +97,9 @@ Feature: cannot share resources outside the group when share with membership gro And user "Brian" has been added to group "grp0" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" When user "Alice" shares folder "/textfile0.txt" with group "grp0" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" - When user "Brian" accepts share "/textfile0.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" + And user "Brian" accepts share "/textfile0.txt" offered by user "Alice" 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 "" And as "Brian" file "/Shares/textfile0.txt" should exist But as "Brian" file "/textfile0.txt" should not exist Examples: @@ -122,11 +116,9 @@ Feature: cannot share resources outside the group when share with membership gro And user "Alice" has been added to group "grp0" And user "Alice" has uploaded file "filesForUpload/textfile.txt" to "/textfile0.txt" When user "Alice" shares folder "/textfile0.txt" with user "Brian" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" - When user "Brian" accepts share "/textfile0.txt" offered by user "Alice" using the sharing API - Then the OCS status code should be "" - And the HTTP status code should be "" + And user "Brian" accepts share "/textfile0.txt" offered by user "Alice" 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 "" And as "Brian" file "/Shares/textfile0.txt" should exist But as "Brian" file "/textfile0.txt" should not exist Examples: diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 9e701e3ee776..bf860fec0068 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -3387,7 +3387,7 @@ public function userDeletesFile(string $user, string $file):void { $this->pauseUploadDelete(); $this->response = $this->makeDavRequest($user, 'DELETE', $file, []); $this->lastUploadDeleteTime = \time(); - $this->pushToLastStatusCodesArrays(); + $this->pushToLastHttpStatusCodesArray((string) $this->getResponse()->getStatusCode()); } /**