diff options
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 51 | ||||
-rw-r--r-- | build/integration/features/sharing-v1.feature | 66 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 49 |
3 files changed, 144 insertions, 22 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 2ef5f252f11..79c447ac573 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -100,6 +100,25 @@ trait WebDav { } /** + * @When /^Downloading last public shared file inside a folder "([^"]*)" with range "([^"]*)"$/ + * @param string $range + */ + public function downloadPublicFileInsideAFolderWithRange($path, $range){ + $token = $this->lastShareData->data->token; + $fullUrl = substr($this->baseUrl, 0, -4) . "public.php/webdav" . "$path"; + $headers['Range'] = $range; + + $client = new GClient(); + $options = []; + $options['auth'] = [$token, ""]; + + $request = $client->createRequest("GET", $fullUrl, $options); + $request->addHeader('Range', $range); + + $this->response = $client->send($request); + } + + /** * @Then /^Downloaded content should be "([^"]*)"$/ * @param string $content */ @@ -373,5 +392,37 @@ trait WebDav { $this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data); } + /** + * @Given user :user creates a new chunking upload with id :id + */ + public function userCreatesANewChunkingUploadWithId($user, $id) + { + $destination = '/uploads/'.$user.'/'.$id; + $this->makeDavRequest($user, 'MKCOL', $destination, []); + } + + /** + * @Given user :user uploads new chunk file :num with :data to id :id + */ + public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id) + { + $data = \GuzzleHttp\Stream\Stream::factory($data); + $destination = '/uploads/'.$user.'/'.$id.'/'.$num; + $this->makeDavRequest($user, 'PUT', $destination, [], $data); + } + + /** + * @Given user :user moves new chunk file with id :id to :dest + */ + public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest) + { + $source = '/uploads/'.$user.'/'.$id.'/.file'; + $destination = substr($this->baseUrl, 0, -4) . $this->davPath . '/files/'.$user.$dest; + $this->makeDavRequest($user, 'MOVE', $source, [ + 'Destination' => $destination + ]); + } + + } diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature index b9d77120b9c..49c2dbf58c6 100644 --- a/build/integration/features/sharing-v1.feature +++ b/build/integration/features/sharing-v1.feature @@ -251,6 +251,20 @@ Feature: sharing And User "user2" should be included in the response And User "user3" should not be included in the response + Scenario: Reshared files can be still accessed if a user in the middle removes it. + Given user "user0" exists + And user "user1" exists + And user "user2" exists + And user "user3" exists + And file "textfile0.txt" of user "user0" is shared with user "user1" + And file "textfile0 (2).txt" of user "user1" is shared with user "user2" + And file "textfile0 (2).txt" of user "user2" is shared with user "user3" + And As an "user1" + When User "user1" deletes file "/textfile0 (2).txt" + And As an "user3" + And Downloading file "/textfile0 (2).txt" with range "bytes=1-7" + Then Downloaded content should be "wnCloud" + Scenario: getting share info of a share Given user "user0" exists And user "user1" exists @@ -571,8 +585,8 @@ Feature: sharing Given user "user0" exists And User "user0" uploads file with content "foo" to "/tmp.txt" When as "user0" gets properties of folder "/tmp.txt" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "19" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "19" Scenario: Correct webdav share-permissions for received file with edit and reshare permissions Given user "user0" exists @@ -580,8 +594,8 @@ Feature: sharing And User "user0" uploads file with content "foo" to "/tmp.txt" And file "tmp.txt" of user "user0" is shared with user "user1" When as "user1" gets properties of folder "/tmp.txt" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "19" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "19" Scenario: Correct webdav share-permissions for received file with edit permissions but no reshare permissions Given user "user0" exists @@ -592,8 +606,8 @@ Feature: sharing And Updating last share with | permissions | 3 | When as "user1" gets properties of folder "/tmp.txt" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "0" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "3" Scenario: Correct webdav share-permissions for received file with reshare permissions but no edit permissions Given user "user0" exists @@ -604,15 +618,15 @@ Feature: sharing And Updating last share with | permissions | 17 | When as "user1" gets properties of folder "/tmp.txt" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "17" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "17" Scenario: Correct webdav share-permissions for owned folder Given user "user0" exists And user "user0" created a folder "/tmp" When as "user0" gets properties of folder "/" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "31" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "31" Scenario: Correct webdav share-permissions for received folder with all permissions Given user "user0" exists @@ -620,8 +634,8 @@ Feature: sharing And user "user0" created a folder "/tmp" And file "/tmp" of user "user0" is shared with user "user1" When as "user1" gets properties of folder "/tmp" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "31" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "31" Scenario: Correct webdav share-permissions for received folder with all permissions but edit Given user "user0" exists @@ -632,8 +646,8 @@ Feature: sharing And Updating last share with | permissions | 29 | When as "user1" gets properties of folder "/tmp" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "29" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "29" Scenario: Correct webdav share-permissions for received folder with all permissions but create Given user "user0" exists @@ -644,8 +658,8 @@ Feature: sharing And Updating last share with | permissions | 27 | When as "user1" gets properties of folder "/tmp" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "27" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "27" Scenario: Correct webdav share-permissions for received folder with all permissions but delete Given user "user0" exists @@ -656,8 +670,8 @@ Feature: sharing And Updating last share with | permissions | 23 | When as "user1" gets properties of folder "/tmp" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "23" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "23" Scenario: Correct webdav share-permissions for received folder with all permissions but share Given user "user0" exists @@ -668,5 +682,17 @@ Feature: sharing And Updating last share with | permissions | 15 | When as "user1" gets properties of folder "/tmp" with - |{http://owncloud.org/ns}share-permissions| - Then the single response should contain a property "{http://owncloud.org/ns}share-permissions" with value "0" + |{http://open-collaboration-services.org/ns}share-permissions | + Then the single response should contain a property "{http://open-collaboration-services.org/ns}share-permissions" with value "15" + + Scenario: unique target names for incomming shares + Given user "user0" exists + And user "user1" exists + And user "user2" exists + And user "user0" created a folder "/foo" + And user "user1" created a folder "/foo" + When file "/foo" of user "user0" is shared with user "user2" + And file "/foo" of user "user1" is shared with user "user2" + Then user "user2" should see following elements + | /foo/ | + | /foo%20(2)/ | diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index ee841f9eb5b..abdc63935e9 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -68,13 +68,22 @@ Feature: webdav-related And Downloading last public shared file with range "bytes=51-77" Then Downloaded content should be "example file for developers" + Scenario: download a public shared file inside a folder with range + Given user "user0" exists + And As an "user0" + When creating a share with + | path | PARENT | + | shareType | 3 | + And Downloading last public shared file inside a folder "/parent.txt" with range "bytes=1-7" + Then Downloaded content should be "wnCloud" + Scenario: Downloading a file on the old endpoint should serve security headers Given using dav path "remote.php/webdav" And As an "admin" When Downloading file "/welcome.txt" Then The following headers should be set |Content-Disposition|attachment| - |Content-Security-Policy|default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *| + |Content-Security-Policy|default-src 'none';| |X-Content-Type-Options |nosniff| |X-Download-Options|noopen| |X-Frame-Options|Sameorigin| @@ -89,7 +98,7 @@ Feature: webdav-related When Downloading file "/welcome.txt" Then The following headers should be set |Content-Disposition|attachment| - |Content-Security-Policy|default-src 'self'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; frame-src *; img-src * data: blob:; font-src 'self' data:; media-src *; connect-src *| + |Content-Security-Policy|default-src 'none';| |X-Content-Type-Options |nosniff| |X-Download-Options|noopen| |X-Frame-Options|Sameorigin| @@ -241,3 +250,39 @@ Feature: webdav-related | 0 | | 1 | | 3 | + + Scenario: Upload chunked file asc with new chunking + Given using dav path "remote.php/dav" + And user "user0" exists + And user "user0" creates a new chunking upload with id "chunking-42" + And user "user0" uploads new chunk file "1" with "AAAAA" to id "chunking-42" + And user "user0" uploads new chunk file "2" with "BBBBB" to id "chunking-42" + And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42" + And user "user0" moves new chunk file with id "chunking-42" to "/myChunkedFile.txt" + When As an "user0" + And Downloading file "/files/user0/myChunkedFile.txt" + Then Downloaded content should be "AAAAABBBBBCCCCC" + + Scenario: Upload chunked file desc with new chunking + Given using dav path "remote.php/dav" + And user "user0" exists + And user "user0" creates a new chunking upload with id "chunking-42" + And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42" + And user "user0" uploads new chunk file "2" with "BBBBB" to id "chunking-42" + And user "user0" uploads new chunk file "1" with "AAAAA" to id "chunking-42" + And user "user0" moves new chunk file with id "chunking-42" to "/myChunkedFile.txt" + When As an "user0" + And Downloading file "/files/user0/myChunkedFile.txt" + Then Downloaded content should be "AAAAABBBBBCCCCC" + + Scenario: Upload chunked file random with new chunking + Given using dav path "remote.php/dav" + And user "user0" exists + And user "user0" creates a new chunking upload with id "chunking-42" + And user "user0" uploads new chunk file "2" with "BBBBB" to id "chunking-42" + And user "user0" uploads new chunk file "3" with "CCCCC" to id "chunking-42" + And user "user0" uploads new chunk file "1" with "AAAAA" to id "chunking-42" + And user "user0" moves new chunk file with id "chunking-42" to "/myChunkedFile.txt" + When As an "user0" + And Downloading file "/files/user0/myChunkedFile.txt" + Then Downloaded content should be "AAAAABBBBBCCCCC" |