diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-02-24 10:39:04 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-02-29 14:36:20 +0100 |
commit | 11215f4e275f7e7d1aafdb8af440550d27562ad8 (patch) | |
tree | 3d133edb995e6e989d27ad02ef1e518ecb8fea52 /build | |
parent | a38e8b6436ccfe173b4d368d094753c71bdbd69f (diff) | |
download | nextcloud-server-11215f4e275f7e7d1aafdb8af440550d27562ad8.tar.gz nextcloud-server-11215f4e275f7e7d1aafdb8af440550d27562ad8.zip |
Return -3 for unlimited quota
Returns -3 for unlimited quota in Webdav response.
Also adjusted personal page to show unlimited quota when set.
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/Provisioning.php | 8 | ||||
-rw-r--r-- | build/integration/features/bootstrap/Sharing.php | 16 | ||||
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 47 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 38 |
4 files changed, 97 insertions, 12 deletions
diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index 65a6611b06c..6d710b2016f 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -531,6 +531,14 @@ trait Provisioning { } /** + * @Given user :user has unlimited quota + */ + public function userHasUnlimitedQuota($user) + { + $this->userHasAQuotaOf($user, 'none'); + } + + /** * @BeforeScenario * @AfterScenario */ diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index faf8e0bf507..ec270ef05ce 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -18,17 +18,17 @@ trait Sharing{ private $lastShareData = null; /** - * @When /^creating a share with$/ + * @Given /^as "([^"]*)" creating a share with$/ * @param \Behat\Gherkin\Node\TableNode|null $formData */ - public function creatingShare($body) { + public function asCreatingAShareWith($user, $body) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v1/shares"; $client = new Client(); $options = []; - if ($this->currentUser === 'admin') { + if ($user === 'admin') { $options['auth'] = $this->adminUser; } else { - $options['auth'] = [$this->currentUser, $this->regularUser]; + $options['auth'] = [$user, $this->regularUser]; } if ($body instanceof \Behat\Gherkin\Node\TableNode) { @@ -50,6 +50,14 @@ trait Sharing{ } /** + * @When /^creating a share with$/ + * @param \Behat\Gherkin\Node\TableNode|null $formData + */ + public function creatingShare($body) { + return $this->asCreatingAShareWith($this->currentUser, $body); + } + + /** * @Then /^Public shared file "([^"]*)" can be downloaded$/ */ public function checkPublicSharedFile($filename) { diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index be87a09731b..fa6761d9f71 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -20,7 +20,7 @@ trait WebDav { */ public function usingDavPath($davPath) { $this->davPath = $davPath; - } + } public function makeDavRequest($user, $method, $path, $headers, $body = null){ $fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path"; @@ -34,7 +34,7 @@ trait WebDav { $request = $client->createRequest($method, $fullUrl, $options); if (!is_null($headers)){ foreach ($headers as $key => $value) { - $request->addHeader($key, $value); + $request->addHeader($key, $value); } } @@ -84,7 +84,7 @@ trait WebDav { $client = new GClient(); $options = []; $options['auth'] = [$token, ""]; - + $request = $client->createRequest("GET", $fullUrl, $options); $request->addHeader('Range', $range); @@ -149,8 +149,37 @@ trait WebDav { } } + /** + * @Then /^as "([^"]*)" gets properties of folder "([^"]*)" with$/ + * @param \Behat\Gherkin\Node\TableNode|null $propertiesTable + */ + public function asGetsPropertiesOfFolderWith($user, $path, $propertiesTable) { + $properties = null; + if ($propertiesTable instanceof \Behat\Gherkin\Node\TableNode) { + foreach ($propertiesTable->getRows() as $row) { + $properties[] = $row[0]; + } + } + $this->response = $this->listFolder($user, $path, 0, $properties); + } + + /** + * @Then the single response should contain a property :key with value :value + */ + public function theSingleResponseShouldContainAPropertyWithValue($key, $expectedValue) { + $keys = $this->response; + if (!isset($keys[$key])) { + throw new \Exception("Cannot find property \"$key\" with \"$expectedalue\""); + } + + $value = $keys[$key]; + if ($value !== $expectedValue) { + throw new \Exception("Property \"$key\" found with value \"$value\", expected \"$expectedValue\""); + } + } + /*Returns the elements of a propfind, $folderDepth requires 1 to see elements without children*/ - public function listFolder($user, $path, $folderDepth){ + public function listFolder($user, $path, $folderDepth, $properties = null){ $fullUrl = substr($this->baseUrl, 0, -4); $settings = array( @@ -166,9 +195,13 @@ trait WebDav { $client = new SClient($settings); - $response = $client->propfind($this->davPath . "/", array( - '{DAV:}getetag' - ), $folderDepth); + if (!$properties) { + $properties = [ + '{DAV:}getetag' + ]; + } + + $response = $client->propfind($this->davPath . '/' . ltrim($path, '/'), $properties, $folderDepth); return $response; } diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index c4623a01ba2..63f205d1e4c 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -1,4 +1,4 @@ -Feature: sharing +Feature: webdav-related Background: Given using api version "1" @@ -23,6 +23,42 @@ Feature: sharing When User "user0" uploads file "data/textfile.txt" to "/asdf.txt" Then the HTTP status code should be "507" + Scenario: Retrieving folder quota when no quota is set + Given using dav path "remote.php/webdav" + And As an "admin" + And user "user0" exists + When user "user0" has unlimited quota + Then as "user0" gets properties of folder "/" with + |{DAV:}quota-available-bytes| + And the single response should contain a property "{DAV:}quota-available-bytes" with value "-3" + + Scenario: Retrieving folder quota when quota is set + Given using dav path "remote.php/webdav" + And As an "admin" + And user "user0" exists + When user "user0" has a quota of "10 MB" + Then as "user0" gets properties of folder "/" with + |{DAV:}quota-available-bytes| + And the single response should contain a property "{DAV:}quota-available-bytes" with value "10485429" + + Scenario: Retrieving folder quota of shared folder with quota when no quota is set for recipient + Given using dav path "remote.php/webdav" + And As an "admin" + And user "user0" exists + And user "user1" exists + And user "user0" has unlimited quota + And user "user1" has a quota of "10 MB" + And As an "user1" + And user "user1" created a folder "/testquota" + And as "user1" creating a share with + | path | testquota | + | shareType | 0 | + | permissions | 31 | + | shareWith | user0 | + Then as "user0" gets properties of folder "/testquota" with + |{DAV:}quota-available-bytes| + And the single response should contain a property "{DAV:}quota-available-bytes" with value "10485429" + Scenario: download a public shared file with range Given user "user0" exists And As an "user0" |