Skip to content

Commit

Permalink
tests added for renaming received shares
Browse files Browse the repository at this point in the history
  • Loading branch information
SwikritiT committed Jan 1, 2021
1 parent 83017e5 commit fcd75b5
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ Feature: sharing
And user "Alice" has created folder "<group_folder>"
And user "Brian" has created folder "<receiver_folder>"
And user "Carol" has created folder "<receiver_folder>"
When user "Alice" shares folder "<sharer_folder>" with user "Brian" using the sharing API
And user "Brian" accepts share "/<sharer_folder>" offered by user "Alice" using the sharing API
And user "Brian" moves folder "<receiver_folder>" to "/Shares/<sharer_folder>/<receiver_folder>" using the WebDAV API
And user "Alice" has shared folder "<sharer_folder>" with user "Brian"
And user "Brian" has accepted share "/<sharer_folder>" offered by user "Alice"
When user "Brian" moves folder "<receiver_folder>" to "/Shares/<sharer_folder>/<receiver_folder>" using the WebDAV API
Then as "Alice" folder "<sharer_folder>/<receiver_folder>" should exist
And as "Brian" folder "/Shares/<sharer_folder>/<receiver_folder>" should exist
When user "Alice" shares folder "<group_folder>" with group "grp1" using the sharing API
Expand Down Expand Up @@ -99,3 +99,115 @@ Feature: sharing
And as "Brian" file "/myFolder/renamedFile" should not exist
But as "Brian" file "/myFolder/fileInside" should exist

Scenario: receiver renames a received share to different name on the same folder
Given user "Alice" has shared folder "PARENT" with user "Brian"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "/Shares/myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "/Shares/myFolder" should exist
But as "Alice" folder "myFolder" should not exist

Scenario: receiver renames a received file share to different name on the same folder
Given user "Alice" has shared file "textfile0.txt" with user "Brian"
And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice"
When user "Brian" moves file "/Shares/textfile0.txt" to "/Shares/newFile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" file "/Shares/newFile.txt" should exist
But as "Alice" file "newFile.txt" should not exist

Scenario: receiver renames a received share to different name on the same folder for group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared folder "PARENT" with group "grp1"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "/Shares/myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "/Shares/myFolder" should exist
But as "Alice" folder "myFolder" should not exist

Scenario: receiver renames a received file share to different name on the same folder for group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared file "textfile0.txt" with group "grp1"
And user "Brian" has accepted share "/textfile0.txt" offered by user "Alice"
When user "Brian" moves file "/Shares/textfile0.txt" to "/Shares/newFile.txt" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" file "/Shares/newFile.txt" should exist
But as "Alice" file "newFile.txt" should not exist

Scenario: receiver renames a received share with share, read, change permissions in group sharing
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared folder "PARENT" with group "grp1" with permissions "share,read,change"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "myFolder" should exist
But as "Alice" folder "myFolder" should not exist
When user "Brian" moves file "/myFolder/parent.txt" to "/myFolder/renamedFile" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" file "/myFolder/renamedFile" should exist
And as "Alice" file "/PARENT/renamedFile" should exist
But as "Alice" file "/PARENT/parent.txt" should not exist

Scenario: receiver tries to rename a received share with share, read permissions
Given group "grp1" has been created
And user "Brian" has been added to group "grp1"
And user "Alice" has shared folder "PARENT" with group "grp1" with permissions "share,read"
And user "Brian" has accepted share "/PARENT" offered by user "Alice"
When user "Brian" moves folder "/Shares/PARENT" to "/myFolder" using the WebDAV API
Then the HTTP status code should be "201"
And as "Brian" folder "myFolder" should exist
But as "Alice" folder "myFolder" should not exist
When user "Brian" moves file "/myFolder/parent.txt" to "/myFolder/renamedFile" using the WebDAV API
Then the HTTP status code should be "403"
And as "Brian" file "/myFolder/renamedFile" should not exist
But as "Brian" file "/myFolder/parent.txt" should exist
But as "Alice" file "/PARENT/parent.txt" should exist
But as "Alice" file "/PARENT/renamedFile" should not exist

Scenario Outline: receiver tries to rename a received share to name with special characters
Given group "grp1" has been created
And user "Carol" has been added to group "grp1"
And user "Alice" has created folder "<sharer_folder>"
And user "Alice" has created folder "<group_folder>"
When user "Alice" shares folder "<sharer_folder>" with user "Brian" using the sharing API
And user "Brian" accepts share "/<sharer_folder>" offered by user "Alice" using the sharing API
And user "Brian" moves folder "/Shares/<sharer_folder>" to "/Shares/<receiver_folder>" using the WebDAV API
Then the HTTP status code should be "201"
And as "Alice" folder "<receiver_folder>" should not exist
And as "Brian" folder "/Shares/<receiver_folder>" should exist
When user "Alice" shares folder "<group_folder>" with group "grp1" using the sharing API
And user "Carol" accepts share "/<group_folder>" offered by user "Alice" using the sharing API
And user "Carol" moves folder "/Shares/<group_folder>" to "/Shares/<receiver_folder>" using the WebDAV API
Then the HTTP status code should be "201"
And as "Alice" folder "<receiver_folder>" should not exist
But as "Carol" folder "/Shares/<receiver_folder>" should exist
Examples:
| sharer_folder | group_folder | receiver_folder |
| ?abc=oc # | ?abc=oc g%rp# | # oc?test=oc&a |
| @a#8a=b?c=d | @a#8a=b?c=d grp | ?a#8 a=b?c=d |

Scenario Outline: receiver tries to rename a received share to name with special characters with share, read, change permissions
Given group "grp1" has been created
And user "Carol" has been added to group "grp1"
And user "Alice" has created folder "<sharer_folder>"
And user "Alice" has created folder "<group_folder>"
And user "Alice" has uploaded file with content "thisIsAFileInsideTheSharedFolder" to "/<sharer_folder>/fileInside"
And user "Alice" has uploaded file with content "thisIsAFileInsideTheSharedFolder" to "/<group_folder>/fileInside"
And user "Alice" has shared folder "<sharer_folder>" with user "Brian" with permissions "share,read,change"
And user "Brian" has accepted share "/<sharer_folder>" offered by user "Alice"
And user "Brian" moves folder "/Shares/<sharer_folder>/fileInside" to "/Shares/<sharer_folder>/<receiver_file>" using the WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "<sharer_folder>/<receiver_file>" should exist
And as "Brian" file "/Shares/<sharer_folder>/<receiver_file>" should exist
When user "Alice" shares folder "<group_folder>" with group "grp1" with permissions "share,read,change" using the sharing API
And user "Carol" accepts share "/<group_folder>" offered by user "Alice" using the sharing API
And user "Carol" moves folder "/Shares/<group_folder>/fileInside" to "/Shares/<group_folder>/<reciever_file>" using the WebDAV API
Then the HTTP status code should be "201"
And as "Alice" file "<group_folder>/<reciever_file>" should exist
And as "Carol" file "/Shares/<group_folder>/<reciever_file>" should exist
Examples:
| sharer_folder | group_folder | receiver_file |
| ?abc=oc # | ?abc=oc g%rp# | # oc?test=oc&a |
| @a#8a=b?c=d | @a#8a=b?c=d grp | ?a#8 a=b?c=d |
2 changes: 1 addition & 1 deletion tests/acceptance/features/bootstrap/Sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ public function shareFileWithUserUsingTheSharingApi(
$user1Actual = $this->getActualUsername($user1);
$user2Actual = $this->getActualUsername($user2);

$path = $this->getSharesEndpointPath("?path=$filepath");
$path = $this->getSharesEndpointPath("?path=" . \urlencode($filepath));
$this->response = OcsApiHelper::sendRequest(
$this->getBaseUrl(),
$user1Actual,
Expand Down

0 comments on commit fcd75b5

Please sign in to comment.