Skip to content

Commit

Permalink
Added implementation for copy operations
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Jul 15, 2022
1 parent f9353fd commit 6d24e0f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 28 deletions.
38 changes: 11 additions & 27 deletions tests/acceptance/features/apiSpaces/copySpaces.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Feature: copy file
And user "Alice" has created a folder "newfolder" in space "Project"
And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt"
And user "Alice" has shared a space "Project" to user "Brian" with role "<role>"
When user "Brian" copies file "insideSpace.txt" to "/newfolder/insideSpace.txt" in space "Project" using the WebDAV API
When user "Brian" copies file "insideSpace.txt" to "/newfolder/insideSpace.txt" inside space "Project" using the WebDAV API
Then the HTTP status code should be "201"
And for user "Brian" the space "Project" should contain these entries:
| newfolder/insideSpace.txt |
Expand All @@ -34,7 +34,7 @@ Feature: copy file
And user "Alice" has created a folder "newfolder" in space "Project"
And user "Alice" has uploaded a file inside space "Project" with content "some content" to "insideSpace.txt"
And user "Alice" has shared a space "Project" to user "Brian" with role "viewer"
When user "Brian" copies file "insideSpace.txt" to "newfolder/insideSpace.txt" in space "Project" using the WebDAV API
When user "Brian" copies file "insideSpace.txt" to "newfolder/insideSpace.txt" inside space "Project" using the WebDAV API
Then the HTTP status code should be "403"
And for user "Brian" the space "Project" should not contain these entries:
| newfolder/insideSpace.txt |
Expand All @@ -45,37 +45,21 @@ Feature: copy file
And user "Brian" has created a space "Project1" with the default quota using the GraphApi
And user "Brian" has created a space "Project2" with the default quota using the GraphApi
And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt"
And user "Brian" has shared a space "Project2" to user "Alice" with role "manager"
And user "Brian" has shared a space "Project1" to user "Alice" with role "<role>"
When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API
Then the HTTP status code should be "201"
And for user "Alice" the space "Project2" should contain these entries:
| project1.txt |
And for user "Alice" the content of the file "project1.txt" of the space "Project2" should be "Project1 content"
Examples:
| role |
| manager |
| editor |
| viewer |


Scenario Outline: User copy a file from a space project with different role to a space project with editor role
Given the administrator has given "Brian" the role "Space Admin" using the settings api
And user "Brian" has created a space "Project1" with the default quota using the GraphApi
And user "Brian" has created a space "Project2" with the default quota using the GraphApi
And user "Brian" has uploaded a file inside space "Project1" with content "Project1 content" to "project1.txt"
And user "Brian" has shared a space "Project2" to user "Alice" with role "editor"
And user "Brian" has shared a space "Project1" to user "Alice" with role "<role>"
And user "Brian" has shared a space "Project2" to user "Alice" with role "<from_role>"
And user "Brian" has shared a space "Project1" to user "Alice" with role "<to_role>"
When user "Alice" copies file "project1.txt" from space "Project1" to "project1.txt" inside space "Project2" using the WebDAV API
Then the HTTP status code should be "201"
And for user "Alice" the space "Project2" should contain these entries:
| project1.txt |
And for user "Alice" the content of the file "project1.txt" of the space "Project2" should be "Project1 content"
Examples:
| role |
| manager |
| editor |
| viewer |
| from_role | to_role |
| manager | manager |
| manager | editor |
| manager | viewer |
| editor | manager |
| editor | editor |
| editor | viewer |


Scenario Outline: User copy a file from a space project with different role to a space project with viewer role
Expand Down
3 changes: 2 additions & 1 deletion tests/acceptance/features/bootstrap/SpacesContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -781,13 +781,14 @@ public function theUserListsTheContentOfAPersonalSpaceRootUsingTheWebDAvApi(
Assert::assertIsArray($space);
Assert::assertNotEmpty($spaceId = $space["id"]);
Assert::assertNotEmpty($spaceWebDavUrl = $space["root"]["webDavUrl"]);
$headers['Depth'] = 'infinity';
$this->featureContext->setResponse(
$this->sendPropfindRequestToUrl(
$spaceWebDavUrl . '/' . $foldersPath,
$user,
$this->featureContext->getPasswordForUser($user),
"",
[],
$headers,
)
);
$this->setResponseSpaceId($spaceId);
Expand Down

0 comments on commit 6d24e0f

Please sign in to comment.