Refactor reShare.feature to use the 'shares file with, with permissions' steps#35551
Conversation
| $this->response = HttpRequestHelper::get( | ||
| $fullUrl, $user1, $this->getPasswordForUser($user1) | ||
| if ($getShareData) { | ||
| $this->response = HttpRequestHelper::get( |
There was a problem hiding this comment.
Previously the When step execution would do this get of the (hopefully) updated share information. That would overwrite $this->response that was saved from createShare(). And so that messed up the ability to check the real OCS and HTTP status after doing When user shares...
The refactoring here allows Given steps to do the code that they were always doing (they verify that the requested share seems to now exist), while letting When steps work properly.
| | shareType | 0 | | ||
| | shareWith | user2 | | ||
| | permissions | 15 | | ||
| And user "user0" has shared file "/textfile0.txt" with user "user1" with permissions 3 |
There was a problem hiding this comment.
Note: when sharing a file, permissions 4 (create) and 8 (delete) are not relevant. If you ask for them, the response comes back (correctly) with them masked out. e.g. ask for permissions 15, actually you only get 3 (read+update), as for permissions 31 and you only get 19 (can reshare+read+update)
So these re-share tests have been refactored to only ask for valid permissions for files.
I will make other sharing test scenarios that properly and separately demonstrate the special behavior when trying to share a file and sking for create and/or delete.
Codecov Report
@@ Coverage Diff @@
## master #35551 +/- ##
=========================================
Coverage 65.66% 65.66%
Complexity 18756 18756
=========================================
Files 1222 1222
Lines 70872 70872
Branches 1289 1289
=========================================
Hits 46540 46540
Misses 23954 23954
Partials 378 378
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #35551 +/- ##
=========================================
Coverage 65.66% 65.66%
Complexity 18756 18756
=========================================
Files 1222 1222
Lines 70872 70872
Branches 1289 1289
=========================================
Hits 46540 46540
Misses 23954 23954
Partials 378 378
Continue to review full report at Codecov.
|
| */ | ||
| public function userSharesFileWithGroupUsingTheSharingApi( | ||
| $user, $filepath, $group, $permissions = null | ||
| public function shareFileWithGroupUsingTheSharingApi( |
There was a problem hiding this comment.
The refactoring here makes the "share with group" scenarios in createShare.feature work properly.
Previously the proper OCS and HTTP statuses were getting "lost". So issue #33733 was a test bug.
538483b to
74e8b87
Compare
74e8b87 to
d0416f0
Compare
|
Backport |
Description
While testing re-sharing, and refactoring some of the test scenarios, I discovered some annoyance and error with test code for steps like
Given user "user0" has shared file...andWhen user "user0" shares file...and similar.The code was always checking that the share that was created was "correct", e.g. it actually got the stated permissions. For
Giventhat is "a good thing", but forWhensteps we should let theThensteps do the checking.The extra checking of the resulting share status was overwriting the initial
createShareresponse. And so test scenarios that did aWhenfollowed by some checks of the OCS and HTTP status were not actually seeing and checking the real statuses returned bycreateShareI also noticed that when sharing a file, the create and delete permissions are not relevant. You can ask for them in the create share request, and they get masked out in the permissions of the created share. This seems reasonable. It would be nice to have some test scenarios that "document" this behavior.
reShare.featureto use the fixed-up stepscreateShare.featurethat ask for create+delete on a file shareRelated Issue
#33733
owncloud/user_ldap#378
#35558
Motivation and Context
Have fixed and improved sharing API test scenarios.
How Has This Been Tested?
Local CI runs
Types of changes
Checklist:
Open tasks: