From 6d24e0fbab78a7d02eb62ee86f707f9a1df91bed Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Tue, 12 Jul 2022 16:08:20 +0545 Subject: [PATCH] Added implementation for copy operations --- .../features/apiSpaces/copySpaces.feature | 38 ++++++------------- .../features/bootstrap/SpacesContext.php | 3 +- 2 files changed, 13 insertions(+), 28 deletions(-) diff --git a/tests/acceptance/features/apiSpaces/copySpaces.feature b/tests/acceptance/features/apiSpaces/copySpaces.feature index b19c0f9525d..1f07308835d 100644 --- a/tests/acceptance/features/apiSpaces/copySpaces.feature +++ b/tests/acceptance/features/apiSpaces/copySpaces.feature @@ -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 "" - 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 | @@ -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 | @@ -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 "" - 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 "" + And user "Brian" has shared a space "Project2" to user "Alice" with role "" + And user "Brian" has shared a space "Project1" to user "Alice" with 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 diff --git a/tests/acceptance/features/bootstrap/SpacesContext.php b/tests/acceptance/features/bootstrap/SpacesContext.php index de2cb86074f..31eaa26d8b5 100644 --- a/tests/acceptance/features/bootstrap/SpacesContext.php +++ b/tests/acceptance/features/bootstrap/SpacesContext.php @@ -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);