Added test checking quota after usage

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Sergio Bertolin 2016-09-26 10:44:14 +00:00 committed by Roeland Jago Douma
parent 6297d201df
commit 7413e2a88c
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
3 changed files with 31 additions and 0 deletions

View File

@ -313,6 +313,13 @@ trait BasicStructure {
file_put_contents("../../data/$user/files" . "$filename", "$text"); file_put_contents("../../data/$user/files" . "$filename", "$text");
} }
public function createFileSpecificSize($user, $name, $size){
$file = fopen("data/" . "$name", 'w');
fseek($file, $size - 1 ,SEEK_CUR);
fwrite($file,'a'); // write a dummy char at SIZE position
fclose($file);
}
/** /**
* @BeforeSuite * @BeforeSuite
*/ */

View File

@ -424,6 +424,20 @@ trait WebDav {
} }
} }
/**
* @When User :user adds a file of :bytes bytes to :destination
* @param string $user
* @param string $bytes
* @param string $destination
*/
public function userAddsAFileTo($user, $bytes, $destination){
$filename = "filespecificSize.txt";
$this->createFileSpecificSize($user, $filename, $bytes);
PHPUnit_Framework_Assert::assertEquals(1, file_exists("data/$filename"));
$this->userUploadsAFileTo($user, "data/$filename", $destination);
$this->removeFile("data/", $filename);
}
/** /**
* @When User :user uploads file with content :content to :destination * @When User :user uploads file with content :content to :destination
*/ */

View File

@ -77,6 +77,16 @@ Feature: webdav-related
When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt" When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt"
Then the HTTP status code should be "201" Then the HTTP status code should be "201"
Scenario: Retrieving folder quota when quota is set and a file was uploaded
Given using dav path "remote.php/webdav"
And As an "admin"
And user "user0" exists
And user "user0" has a quota of "1 KB"
And user "user0" adds a file of 93 bytes to "/prueba.txt"
When as "user0" gets properties of folder "/" with
|{DAV:}quota-available-bytes|
Then the single response should contain a property "{DAV:}quota-available-bytes" with value "600"
Scenario: download a public shared file with range Scenario: download a public shared file with range
Given user "user0" exists Given user "user0" exists
And As an "user0" And As an "user0"