diff options
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 18 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 9 | ||||
-rw-r--r-- | tests/lib/cache/file.php | 7 | ||||
-rw-r--r-- | tests/lib/files/etagtest.php | 7 |
4 files changed, 35 insertions, 6 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 8f0f30b377a..a682467f52d 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -73,6 +73,24 @@ trait WebDav{ } /** + * @When /^Downloading last public shared file with range "([^"]*)"$/ + */ + public function downloadPublicFileWithRange($range){ + $token = $this->lastShareData->data->token; + $fullUrl = substr($this->baseUrl, 0, -4) . "public.php/webdav"; + $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 "([^"]*)"$/ */ public function downloadedContentShouldBe($content){ diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index 56c4d07f0eb..8be2c196308 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -24,6 +24,15 @@ Feature: sharing When User "user0" uploads file "data/textfile.txt" to "/asdf.txt" Then the HTTP status code should be "507" + Scenario: download a public shared file with range + Given user "user0" exists + And As an "user0" + When creating a share with + | path | welcome.txt | + | shareType | 3 | + And Downloading last public shared file with range "bytes=51-77" + Then Downloaded content should be "example file for developers" + diff --git a/tests/lib/cache/file.php b/tests/lib/cache/file.php index 6db5acdf13f..7aa969df02c 100644 --- a/tests/lib/cache/file.php +++ b/tests/lib/cache/file.php @@ -63,8 +63,9 @@ class FileCache extends \Test_Cache { $storage = new \OC\Files\Storage\Temporary(array()); \OC\Files\Filesystem::mount($storage,array(),'/'); $datadir = str_replace('local::', '', $storage->getId()); - $this->datadir = \OC_Config::getValue('cachedirectory', \OC::$SERVERROOT.'/data/cache'); - \OC_Config::setValue('cachedirectory', $datadir); + $config = \OC::$server->getConfig(); + $this->datadir = $config->getSystemValue('cachedirectory', \OC::$SERVERROOT.'/data/cache'); + $config->setSystemValue('cachedirectory', $datadir); \OC_User::clearBackends(); \OC_User::useBackend(new \Test\Util\User\Dummy()); @@ -89,7 +90,7 @@ class FileCache extends \Test_Cache { $this->instance->remove('hack', 'hack'); \OC_User::setUserId($this->user); - \OC_Config::setValue('cachedirectory', $this->datadir); + \OC::$server->getConfig()->setSystemValue('cachedirectory', $this->datadir); // Restore the original mount point \OC\Files\Filesystem::clearMounts(); diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php index 7fbeae88820..c214a3d4da6 100644 --- a/tests/lib/files/etagtest.php +++ b/tests/lib/files/etagtest.php @@ -37,16 +37,17 @@ class EtagTest extends \Test\TestCase { \OCP\Share::registerBackend('file', 'OC_Share_Backend_File'); \OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file'); - $this->datadir = \OC_Config::getValue('datadirectory'); + $config = \OC::$server->getConfig(); + $this->datadir = $config->getSystemValue('datadirectory'); $this->tmpDir = \OC_Helper::tmpFolder(); - \OC_Config::setValue('datadirectory', $this->tmpDir); + $config->setSystemValue('datadirectory', $this->tmpDir); $this->userBackend = new \Test\Util\User\Dummy(); \OC_User::useBackend($this->userBackend); } protected function tearDown() { - \OC_Config::setValue('datadirectory', $this->datadir); + \OC::$server->getConfig()->setSystemValue('datadirectory', $this->datadir); $this->logout(); parent::tearDown(); |