]> source.dussan.org Git - nextcloud-server.git/commitdiff
Added webdav test to check range downloads
authorSergio Bertolin <sbertolin@solidgear.es>
Mon, 30 Nov 2015 14:07:02 +0000 (14:07 +0000)
committerSergio Bertolin <sbertolin@solidgear.es>
Mon, 30 Nov 2015 14:07:02 +0000 (14:07 +0000)
build/integration/features/bootstrap/WebDav.php
build/integration/features/webdav-related.feature

index 2bbe44e9c59dd528a82e7628569474553fec1e06..567f189c61e3f1076b1593d8683aec0cef2b567f 100644 (file)
@@ -58,6 +58,22 @@ trait WebDav{
                $this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
        }
 
+       /**
+        * @When /^Downloading file "([^"]*)" with range "([^"]*)"$/
+        */
+       public function downloadFileWithRange($fileSource, $range){
+               $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
+               $headers['Range'] = $range;
+               $this->response = $this->makeDavRequest($this->currentUser, "GET", $fileSource, $headers);
+       }
+
+       /**
+        * @Then /^Downloaded content should be "([^"]*)"$/
+        */
+       public function downloadedContentShouldBe($content){
+               PHPUnit_Framework_Assert::assertEquals($content, (string)$this->response->getBody());
+       }
+
        /*Returns the elements of a propfind, $folderDepth requires 1 to see elements without children*/
        public function listFolder($user, $path, $folderDepth){
                $fullUrl = substr($this->baseUrl, 0, -4);
index 961b6b03431967b2516d41400f5c2068555da02b..16955e27063c812c8ce6ced5d3e208e0ea361297 100644 (file)
@@ -9,6 +9,12 @@ Feature: sharing
                When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt"
                Then the HTTP status code should be "201"
 
+       Scenario: download a file with range
+               Given using dav path "remote.php/webdav"
+               And As an "admin"
+               When Downloading file "/welcome.txt" with range "bytes=51-77"
+               Then Downloaded content should be "example file for developers"
+