Merge pull request #1880 from nextcloud/downstream-26235

Integration tests refactoring
This commit is contained in:
Morris Jobke 2016-11-04 12:09:00 +01:00 committed by GitHub
commit 6a156b795c
7 changed files with 274 additions and 144 deletions

View File

@ -360,6 +360,14 @@ trait BasicStructure {
$this->theHTTPStatusCodeShouldBe('200');
}
/**
* @When Sleep for :seconds seconds
* @param int $seconds
*/
public function sleepForSeconds($seconds) {
sleep((int)$seconds);
}
/**
* @BeforeSuite
*/

View File

@ -40,6 +40,8 @@ trait WebDav {
/** @var string*/
private $davPath = "remote.php/webdav";
/** @var boolean*/
private $usingOldDavPath = true;
/** @var ResponseInterface */
private $response;
/** @var map with user as key and another map as value, which has path as key and etag as value */
@ -53,19 +55,35 @@ trait WebDav {
}
/**
* @return string
* @Given /^using old dav path$/
*/
public function getFilesPath($user) {
if ($this->davPath === "remote.php/dav") {
$basePath = '/files/' . $user . '/';
} else {
$basePath = '/';
}
return $basePath;
public function usingOldDavPath() {
$this->davPath = "remote.php/webdav";
$this->usingOldDavPath = true;
}
public function makeDavRequest($user, $method, $path, $headers, $body = null){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path";
/**
* @Given /^using new dav path$/
*/
public function usingNewDavPath() {
$this->davPath = "remote.php/dav";
$this->usingOldDavPath = false;
}
public function getDavFilesPath($user){
if ($this->usingOldDavPath === true){
return $this->davPath;
} else {
return $this->davPath . '/files/' . $user;
}
}
public function makeDavRequest($user, $method, $path, $headers, $body = null, $type = "files"){
if ( $type === "files" ){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user) . "$path";
} else if ( $type === "uploads" ){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath . "$path";
}
$client = new GClient();
$options = [];
if ($user === 'admin') {
@ -95,7 +113,7 @@ trait WebDav {
* @param string $fileDestination
*/
public function userMovedFile($user, $entry, $fileSource, $fileDestination){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
$fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user);
$headers['Destination'] = $fullUrl . $fileDestination;
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
PHPUnit_Framework_Assert::assertEquals(201, $this->response->getStatusCode());
@ -108,9 +126,13 @@ trait WebDav {
* @param string $fileDestination
*/
public function userMovesFile($user, $entry, $fileSource, $fileDestination){
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
$fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user);
$headers['Destination'] = $fullUrl . $fileDestination;
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
try {
$this->response = $this->makeDavRequest($user, "MOVE", $fileSource, $headers);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$this->response = $e->getResponse();
}
}
/**
@ -120,7 +142,7 @@ trait WebDav {
* @param string $fileDestination
*/
public function userCopiesFileTo($user, $fileSource, $fileDestination) {
$fullUrl = substr($this->baseUrl, 0, -4) . $this->davPath;
$fullUrl = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user);
$headers['Destination'] = $fullUrl . $fileDestination;
try {
$this->response = $this->makeDavRequest($user, 'COPY', $fileSource, $headers);
@ -202,7 +224,11 @@ trait WebDav {
* @param string $fileName
*/
public function downloadingFile($fileName) {
$this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileName, []);
try {
$this->response = $this->makeDavRequest($this->currentUser, 'GET', $fileName, []);
} catch (\GuzzleHttp\Exception\ClientException $e) {
$this->response = $e->getResponse();
}
}
/**
@ -246,12 +272,13 @@ trait WebDav {
}
/**
* @Then /^as "([^"]*)" gets properties of folder "([^"]*)" with$/
* @Then /^as "([^"]*)" gets properties of (file|folder|entry) "([^"]*)" with$/
* @param string $user
* @param string $elementType
* @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
*/
public function asGetsPropertiesOfFolderWith($user, $path, $propertiesTable) {
public function asGetsPropertiesOfFolderWith($user, $elementType, $path, $propertiesTable) {
$properties = null;
if ($propertiesTable instanceof \Behat\Gherkin\Node\TableNode) {
foreach ($propertiesTable->getRows() as $row) {
@ -371,7 +398,7 @@ trait WebDav {
}
public function makeSabrePath($user, $path) {
return $this->encodePath($this->davPath . $this->getFilesPath($user) . ltrim($path, '/'));
return $this->encodePath($this->getDavFilesPath($user) . $path);
}
public function getSabreClient($user) {
@ -402,7 +429,7 @@ trait WebDav {
$elementRows = $expectedElements->getRows();
$elementsSimplified = $this->simplifyArray($elementRows);
foreach($elementsSimplified as $expectedElement) {
$webdavPath = "/" . $this->davPath . $expectedElement;
$webdavPath = "/" . $this->getDavFilesPath($user) . $expectedElement;
if (!array_key_exists($webdavPath,$elementList)){
PHPUnit_Framework_Assert::fail("$webdavPath" . " is not in propfind answer");
}
@ -478,7 +505,7 @@ trait WebDav {
*/
public function userCreatedAFolder($user, $destination) {
try {
$this->response = $this->makeDavRequest($user, "MKCOL", $this->getFilesPath($user) . ltrim($destination, $this->getFilesPath($user)), []);
$this->response = $this->makeDavRequest($user, "MKCOL", $destination, []);
} catch (\GuzzleHttp\Exception\ServerException $e) {
// 4xx and 5xx responses cause an exception
$this->response = $e->getResponse();
@ -497,8 +524,8 @@ trait WebDav {
{
$num -= 1;
$data = \GuzzleHttp\Stream\Stream::factory($data);
$file = $destination . '-chunking-42-'.$total.'-'.$num;
$this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data);
$file = $destination . '-chunking-42-' . $total . '-' . $num;
$this->makeDavRequest($user, 'PUT', $file, ['OC-Chunked' => '1'], $data, "uploads");
}
/**
@ -507,7 +534,7 @@ trait WebDav {
public function userCreatesANewChunkingUploadWithId($user, $id)
{
$destination = '/uploads/'.$user.'/'.$id;
$this->makeDavRequest($user, 'MKCOL', $destination, []);
$this->makeDavRequest($user, 'MKCOL', $destination, [], null, "uploads");
}
/**
@ -516,8 +543,8 @@ trait WebDav {
public function userUploadsNewChunkFileOfWithToId($user, $num, $data, $id)
{
$data = \GuzzleHttp\Stream\Stream::factory($data);
$destination = '/uploads/'.$user.'/'.$id.'/'.$num;
$this->makeDavRequest($user, 'PUT', $destination, [], $data);
$destination = '/uploads/'. $user .'/'. $id .'/' . $num;
$this->makeDavRequest($user, 'PUT', $destination, [], $data, "uploads");
}
/**
@ -525,11 +552,11 @@ trait WebDav {
*/
public function userMovesNewChunkFileWithIdToMychunkedfile($user, $id, $dest)
{
$source = '/uploads/'.$user.'/'.$id.'/.file';
$destination = substr($this->baseUrl, 0, -4) . $this->davPath . '/files/'.$user.$dest;
$source = '/uploads/' . $user . '/' . $id . '/.file';
$destination = substr($this->baseUrl, 0, -4) . $this->getDavFilesPath($user) . $dest;
$this->makeDavRequest($user, 'MOVE', $source, [
'Destination' => $destination
]);
], null, "uploads");
}
@ -588,26 +615,16 @@ trait WebDav {
];
}
$response = $client->proppatch($this->davPath . $this->getFilesPath($user) . ltrim($path, '/'), $properties, $folderDepth);
$response = $client->proppatch($this->getDavFilesPath($user) . $path, $properties, $folderDepth);
return $response;
}
/**
* @Then /^as "([^"]*)" gets properties of file "([^"]*)" with$/
* @param string $user
* @param string $path
* @param \Behat\Gherkin\Node\TableNode|null $propertiesTable
*/
public function asGetsPropertiesOfFileWith($user, $path, $propertiesTable) {
$this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable);
}
/**
* @Given user :user stores etag of element :path
*/
public function userStoresEtagOfElement($user, $path){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable);
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
$pathETAG[$path] = $this->response['{DAV:}getetag'];
$this->storedETAG[$user]= $pathETAG;
print_r($this->storedETAG[$user][$path]);
@ -618,7 +635,7 @@ trait WebDav {
*/
public function checkIfETAGHasNotChanged($path, $user){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable);
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
PHPUnit_Framework_Assert::assertEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
@ -627,7 +644,7 @@ trait WebDav {
*/
public function checkIfETAGHasChanged($path, $user){
$propertiesTable = new \Behat\Gherkin\Node\TableNode([['{DAV:}getetag']]);
$this->asGetsPropertiesOfFolderWith($user, $path, $propertiesTable);
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
}
}

View File

@ -3,24 +3,24 @@ Feature: dav-v2
Given using api version "1"
Scenario: moving a file new endpoint way
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
When User "user0" moves file "/files/user0/textfile0.txt" to "/files/user0/FOLDER/textfile0.txt"
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 using new endpoint
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
And As an "user0"
When Downloading file "/files/user0/welcome.txt" with range "bytes=52-78"
When Downloading file "/welcome.txt" with range "bytes=52-78"
Then Downloaded content should be "example file for developers"
Scenario: Downloading a file on the new endpoint should serve security headers
Given using dav path "remote.php/dav/files/admin/"
Given using new dav path
And As an "admin"
When Downloading file "welcome.txt"
When Downloading file "/welcome.txt"
Then The following headers should be set
|Content-Disposition|attachment; filename*=UTF-8''welcome.txt; filename="welcome.txt"|
|Content-Security-Policy|default-src 'none';|
@ -55,16 +55,16 @@ Feature: dav-v2
Then the HTTP status code should be "207"
Scenario: Uploading a file having 0B as quota
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
And user "user0" has a quota of "0 B"
And As an "user0"
When User "user0" uploads file "data/textfile.txt" to "/files/user0/asdf.txt"
When User "user0" uploads file "data/textfile.txt" to "/asdf.txt"
Then the HTTP status code should be "507"
Scenario: Uploading a file as recipient using webdav new endpoint having quota
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
@ -78,5 +78,5 @@ Feature: dav-v2
| permissions | 31 |
| shareWith | user0 |
And As an "user0"
When User "user0" uploads file "data/textfile.txt" to "/files/user0/testquota/asdf.txt"
When User "user0" uploads file "data/textfile.txt" to "/testquota/asdf.txt"
Then the HTTP status code should be "201"

View File

@ -1,7 +1,7 @@
Feature: external-storage
Background:
Given using api version "1"
Given using dav path "remote.php/webdav"
Given using old dav path
@local_storage
Scenario: Share by link a file inside a local external storage

View File

@ -3,7 +3,7 @@ Feature: favorite
Given using api version "1"
Scenario: Favorite a folder
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/FOLDER"
@ -12,7 +12,7 @@ Feature: favorite
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"
Scenario: Favorite and unfavorite a folder
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/FOLDER"
@ -22,7 +22,7 @@ Feature: favorite
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value ""
Scenario: Favorite a file
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/textfile0.txt"
@ -31,7 +31,7 @@ Feature: favorite
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"
Scenario: Favorite and unfavorite a file
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/textfile0.txt"
@ -41,7 +41,7 @@ Feature: favorite
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value ""
Scenario: Favorite a folder new endpoint
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/FOLDER"
@ -50,7 +50,7 @@ Feature: favorite
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"
Scenario: Favorite and unfavorite a folder new endpoint
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/FOLDER"
@ -60,7 +60,7 @@ Feature: favorite
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value ""
Scenario: Favorite a file new endpoint
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/textfile0.txt"
@ -69,7 +69,7 @@ Feature: favorite
And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "1"
Scenario: Favorite and unfavorite a file new endpoint
Given using dav path "remote.php/dav"
Given using new dav path
And As an "admin"
And user "user0" exists
When user "user0" favorites element "/textfile0.txt"

View File

@ -1,7 +1,7 @@
Feature: sharing
Background:
Given using api version "1"
Given using dav path "remote.php/webdav"
Given using old dav path
Scenario: Creating a new share with user
Given user "user0" exists
@ -570,7 +570,7 @@ Feature: sharing
| /myFOLDER/myTMP/ |
Scenario: Check quota of owners parent directory of a shared file
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
@ -644,7 +644,7 @@ Feature: sharing
Given user "user0" exists
And user "user1" exists
And User "user0" uploads file with content "foo" to "/tmp.txt"
And file "tmp.txt" of user "user0" is shared with user "user1"
And file "/tmp.txt" of user "user0" is shared with user "user1"
When as "user1" gets properties of folder "/tmp.txt" with
|{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"
@ -779,16 +779,17 @@ Feature: sharing
And the HTTP status code should be "200"
Scenario: Merging shares for recipient when shared from outside with group and member
Given As an "admin"
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
And group "group1" exists
And user "user1" belongs to group "group1"
And user "user0" created a folder "merge-test-outside"
When folder "merge-test-outside" of user "user0" is shared with group "group1"
And folder "merge-test-outside" of user "user0" is shared with user "user1"
Then as "user1" the folder "merge-test-outside" exists
And as "user1" the folder "merge-test-outside (2)" does not exist
And user "user0" created a folder "/merge-test-outside"
When folder "/merge-test-outside" of user "user0" is shared with group "group1"
And folder "/merge-test-outside" of user "user0" is shared with user "user1"
Then as "user1" the folder "/merge-test-outside" exists
And as "user1" the folder "/merge-test-outside (2)" does not exist
Scenario: Merging shares for recipient when shared from outside with group and member with different permissions
Given As an "admin"
@ -796,13 +797,13 @@ Feature: sharing
And user "user1" exists
And group "group1" exists
And user "user1" belongs to group "group1"
And user "user0" created a folder "merge-test-outside-perms"
When folder "merge-test-outside-perms" of user "user0" is shared with group "group1" with permissions 1
And folder "merge-test-outside-perms" of user "user0" is shared with user "user1" with permissions 31
Then as "user1" gets properties of folder "merge-test-outside-perms" with
And user "user0" created a folder "/merge-test-outside-perms"
When folder "/merge-test-outside-perms" of user "user0" is shared with group "group1" with permissions 1
And folder "/merge-test-outside-perms" of user "user0" is shared with user "user1" with permissions 31
Then as "user1" gets properties of folder "/merge-test-outside-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And as "user1" the folder "merge-test-outside-perms (2)" does not exist
And as "user1" the folder "/merge-test-outside-perms (2)" does not exist
Scenario: Merging shares for recipient when shared from outside with two groups
Given As an "admin"
@ -812,11 +813,11 @@ Feature: sharing
And group "group2" exists
And user "user1" belongs to group "group1"
And user "user1" belongs to group "group2"
And user "user0" created a folder "merge-test-outside-twogroups"
When folder "merge-test-outside-twogroups" of user "user0" is shared with group "group1"
And folder "merge-test-outside-twogroups" of user "user0" is shared with group "group2"
Then as "user1" the folder "merge-test-outside-twogroups" exists
And as "user1" the folder "merge-test-outside-twogroups (2)" does not exist
And user "user0" created a folder "/merge-test-outside-twogroups"
When folder "/merge-test-outside-twogroups" of user "user0" is shared with group "group1"
And folder "/merge-test-outside-twogroups" of user "user0" is shared with group "group2"
Then as "user1" the folder "/merge-test-outside-twogroups" exists
And as "user1" the folder "/merge-test-outside-twogroups (2)" does not exist
Scenario: Merging shares for recipient when shared from outside with two groups with different permissions
Given As an "admin"
@ -826,13 +827,13 @@ Feature: sharing
And group "group2" exists
And user "user1" belongs to group "group1"
And user "user1" belongs to group "group2"
And user "user0" created a folder "merge-test-outside-twogroups-perms"
When folder "merge-test-outside-twogroups-perms" of user "user0" is shared with group "group1" with permissions 1
And folder "merge-test-outside-twogroups-perms" of user "user0" is shared with group "group2" with permissions 31
Then as "user1" gets properties of folder "merge-test-outside-twogroups-perms" with
And user "user0" created a folder "/merge-test-outside-twogroups-perms"
When folder "/merge-test-outside-twogroups-perms" of user "user0" is shared with group "group1" with permissions 1
And folder "/merge-test-outside-twogroups-perms" of user "user0" is shared with group "group2" with permissions 31
Then as "user1" gets properties of folder "/merge-test-outside-twogroups-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And as "user1" the folder "merge-test-outside-twogroups-perms (2)" does not exist
And as "user1" the folder "/merge-test-outside-twogroups-perms (2)" does not exist
Scenario: Merging shares for recipient when shared from outside with two groups and member
Given As an "admin"
@ -842,24 +843,24 @@ Feature: sharing
And group "group2" exists
And user "user1" belongs to group "group1"
And user "user1" belongs to group "group2"
And user "user0" created a folder "merge-test-outside-twogroups-member-perms"
When folder "merge-test-outside-twogroups-member-perms" of user "user0" is shared with group "group1" with permissions 1
And folder "merge-test-outside-twogroups-member-perms" of user "user0" is shared with group "group2" with permissions 31
And folder "merge-test-outside-twogroups-member-perms" of user "user0" is shared with user "user1" with permissions 1
Then as "user1" gets properties of folder "merge-test-outside-twogroups-member-perms" with
And user "user0" created a folder "/merge-test-outside-twogroups-member-perms"
When folder "/merge-test-outside-twogroups-member-perms" of user "user0" is shared with group "group1" with permissions 1
And folder "/merge-test-outside-twogroups-member-perms" of user "user0" is shared with group "group2" with permissions 31
And folder "/merge-test-outside-twogroups-member-perms" of user "user0" is shared with user "user1" with permissions 1
Then as "user1" gets properties of folder "/merge-test-outside-twogroups-member-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And as "user1" the folder "merge-test-outside-twogroups-member-perms (2)" does not exist
And as "user1" the folder "/merge-test-outside-twogroups-member-perms (2)" does not exist
Scenario: Merging shares for recipient when shared from inside with group
Given As an "admin"
And user "user0" exists
And group "group1" exists
And user "user0" belongs to group "group1"
And user "user0" created a folder "merge-test-inside-group"
And user "user0" created a folder "/merge-test-inside-group"
When folder "/merge-test-inside-group" of user "user0" is shared with group "group1"
Then as "user0" the folder "merge-test-inside-group" exists
And as "user0" the folder "merge-test-inside-group (2)" does not exist
Then as "user0" the folder "/merge-test-inside-group" exists
And as "user0" the folder "/merge-test-inside-group (2)" does not exist
Scenario: Merging shares for recipient when shared from inside with two groups
Given As an "admin"
@ -868,12 +869,12 @@ Feature: sharing
And group "group2" exists
And user "user0" belongs to group "group1"
And user "user0" belongs to group "group2"
And user "user0" created a folder "merge-test-inside-twogroups"
When folder "merge-test-inside-twogroups" of user "user0" is shared with group "group1"
And folder "merge-test-inside-twogroups" of user "user0" is shared with group "group2"
Then as "user0" the folder "merge-test-inside-twogroups" exists
And as "user0" the folder "merge-test-inside-twogroups (2)" does not exist
And as "user0" the folder "merge-test-inside-twogroups (3)" does not exist
And user "user0" created a folder "/merge-test-inside-twogroups"
When folder "/merge-test-inside-twogroups" of user "user0" is shared with group "group1"
And folder "/merge-test-inside-twogroups" of user "user0" is shared with group "group2"
Then as "user0" the folder "/merge-test-inside-twogroups" exists
And as "user0" the folder "/merge-test-inside-twogroups (2)" does not exist
And as "user0" the folder "/merge-test-inside-twogroups (3)" does not exist
Scenario: Merging shares for recipient when shared from inside with group with less permissions
Given As an "admin"
@ -882,14 +883,14 @@ Feature: sharing
And group "group2" exists
And user "user0" belongs to group "group1"
And user "user0" belongs to group "group2"
And user "user0" created a folder "merge-test-inside-twogroups-perms"
When folder "merge-test-inside-twogroups-perms" of user "user0" is shared with group "group1"
And folder "merge-test-inside-twogroups-perms" of user "user0" is shared with group "group2"
Then as "user0" gets properties of folder "merge-test-inside-twogroups-perms" with
And user "user0" created a folder "/merge-test-inside-twogroups-perms"
When folder "/merge-test-inside-twogroups-perms" of user "user0" is shared with group "group1"
And folder "/merge-test-inside-twogroups-perms" of user "user0" is shared with group "group2"
Then as "user0" gets properties of folder "/merge-test-inside-twogroups-perms" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "RDNVCK"
And as "user0" the folder "merge-test-inside-twogroups-perms (2)" does not exist
And as "user0" the folder "merge-test-inside-twogroups-perms (3)" does not exist
And as "user0" the folder "/merge-test-inside-twogroups-perms (2)" does not exist
And as "user0" the folder "/merge-test-inside-twogroups-perms (3)" does not exist
Scenario: Merging shares for recipient when shared from outside with group then user and recipient renames in between
Given As an "admin"
@ -897,29 +898,32 @@ Feature: sharing
And user "user1" exists
And group "group1" exists
And user "user1" belongs to group "group1"
And user "user0" created a folder "merge-test-outside-groups-renamebeforesecondshare"
When folder "merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with group "group1"
And user "user0" created a folder "/merge-test-outside-groups-renamebeforesecondshare"
When folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with group "group1"
And User "user1" moved folder "/merge-test-outside-groups-renamebeforesecondshare" to "/merge-test-outside-groups-renamebeforesecondshare-renamed"
And folder "merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with user "user1"
Then as "user1" gets properties of folder "merge-test-outside-groups-renamebeforesecondshare-renamed" with
And Sleep for "1" seconds
And folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with user "user1"
Then as "user1" gets properties of folder "/merge-test-outside-groups-renamebeforesecondshare-renamed" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And as "user1" the folder "merge-test-outside-groups-renamebeforesecondshare" does not exist
And as "user1" the folder "/merge-test-outside-groups-renamebeforesecondshare" does not exist
# Scenario: Merging shares for recipient when shared from outside with user then group and recipient renames in between
# Given As an "admin"
# And user "user0" exists
# And user "user1" exists
# And group "group1" exists
# And user "user1" belongs to group "group1"
# And user "user0" created a folder "merge-test-outside-groups-renamebeforesecondshare"
# When folder "merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with user "user1"
# And User "user1" moved folder "/merge-test-outside-groups-renamebeforesecondshare" to "/merge-test-outside-groups-renamebeforesecondshare-renamed"
# And folder "merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with group "group1"
# Then as "user1" gets properties of folder "merge-test-outside-groups-renamebeforesecondshare-renamed" with
# |{http://owncloud.org/ns}permissions|
# And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
# And as "user1" the folder "merge-test-outside-groups-renamebeforesecondshare" does not exist
Scenario: Merging shares for recipient when shared from outside with user then group and recipient renames in between
Given using old dav path
Given As an "admin"
And user "user0" exists
And user "user1" exists
And group "group1" exists
And user "user1" belongs to group "group1"
And user "user0" created a folder "/merge-test-outside-groups-renamebeforesecondshare"
When folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with user "user1"
And User "user1" moved folder "/merge-test-outside-groups-renamebeforesecondshare" to "/merge-test-outside-groups-renamebeforesecondshare-renamed"
And Sleep for "1" seconds
And folder "/merge-test-outside-groups-renamebeforesecondshare" of user "user0" is shared with group "group1"
Then as "user1" gets properties of folder "/merge-test-outside-groups-renamebeforesecondshare-renamed" with
|{http://owncloud.org/ns}permissions|
And the single response should contain a property "{http://owncloud.org/ns}permissions" with value "SRDNVCK"
And as "user1" the folder "/merge-test-outside-groups-renamebeforesecondshare" does not exist
Scenario: Empting trashbin
Given As an "admin"
@ -937,7 +941,7 @@ Feature: sharing
And file "/common/sub" of user "user0" is shared with user "user1"
And User "user0" deletes folder "/common"
When User "user0" empties trashbin
Then as "user1" the folder "sub" does not exist
Then as "user1" the folder "/sub" does not exist
Scenario: sharing again an own file while belonging to a group
Given As an "admin"

View File

@ -2,21 +2,122 @@ Feature: webdav-related
Background:
Given using api version "1"
Scenario: moving a file old way
Given using dav path "remote.php/webdav"
Scenario: Moving a file
Given using old dav path
And As an "admin"
And user "user0" exists
When User "user0" moves file "/textfile0.txt" to "/FOLDER/textfile0.txt"
And As an "user0"
When User "user0" moves file "/welcome.txt" to "/FOLDER/welcome.txt"
Then the HTTP status code should be "201"
And Downloaded content when downloading file "/FOLDER/welcome.txt" with range "bytes=0-6" should be "Welcome"
Scenario: Moving and overwriting a file old way
Given using old dav path
And As an "admin"
And user "user0" exists
And As an "user0"
When User "user0" moves file "/welcome.txt" to "/textfile0.txt"
Then the HTTP status code should be "204"
And Downloaded content when downloading file "/textfile0.txt" with range "bytes=0-6" should be "Welcome"
Scenario: Moving a file to a folder with no permissions
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
And As an "user1"
And user "user1" created a folder "/testshare"
And as "user1" creating a share with
| path | testshare |
| shareType | 0 |
| permissions | 1 |
| shareWith | user0 |
And As an "user0"
And User "user0" moves file "/textfile0.txt" to "/testshare/textfile0.txt"
And the HTTP status code should be "403"
When Downloading file "/testshare/textfile0.txt"
Then the HTTP status code should be "404"
Scenario: Moving a file to overwrite a file in a folder with no permissions
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
And As an "user1"
And user "user1" created a folder "/testshare"
And as "user1" creating a share with
| path | testshare |
| shareType | 0 |
| permissions | 1 |
| shareWith | user0 |
And User "user1" copies file "/welcome.txt" to "/testshare/overwritethis.txt"
And As an "user0"
When User "user0" moves file "/textfile0.txt" to "/testshare/overwritethis.txt"
Then the HTTP status code should be "403"
And Downloaded content when downloading file "/testshare/overwritethis.txt" with range "bytes=0-6" should be "Welcome"
Scenario: Copying a file
Given using old dav path
And As an "admin"
And user "user0" exists
And As an "user0"
When User "user0" copies file "/welcome.txt" to "/FOLDER/welcome.txt"
Then the HTTP status code should be "201"
And Downloaded content when downloading file "/FOLDER/welcome.txt" with range "bytes=0-6" should be "Welcome"
Scenario: Copying and overwriting a file
Given using old dav path
And As an "admin"
And user "user0" exists
And As an "user0"
When User "user0" copies file "/welcome.txt" to "/textfile1.txt"
Then the HTTP status code should be "204"
And Downloaded content when downloading file "/textfile1.txt" with range "bytes=0-6" should be "Welcome"
Scenario: Copying a file to a folder with no permissions
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
And As an "user1"
And user "user1" created a folder "/testshare"
And as "user1" creating a share with
| path | testshare |
| shareType | 0 |
| permissions | 1 |
| shareWith | user0 |
And As an "user0"
When User "user0" copies file "/textfile0.txt" to "/testshare/textfile0.txt"
Then the HTTP status code should be "403"
And Downloading file "/testshare/textfile0.txt"
And the HTTP status code should be "404"
Scenario: Copying a file to overwrite a file into a folder with no permissions
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
And As an "user1"
And user "user1" created a folder "/testshare"
And as "user1" creating a share with
| path | testshare |
| shareType | 0 |
| permissions | 1 |
| shareWith | user0 |
And User "user1" copies file "/welcome.txt" to "/testshare/overwritethis.txt"
And As an "user0"
When User "user0" copies file "/textfile0.txt" to "/testshare/overwritethis.txt"
Then the HTTP status code should be "403"
And Downloaded content when downloading file "/testshare/overwritethis.txt" with range "bytes=0-6" should be "Welcome"
Scenario: download a file with range
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
When Downloading file "/welcome.txt" with range "bytes=52-78"
Then Downloaded content should be "example file for developers"
Scenario: Upload forbidden if quota is 0
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user0" has a quota of "0"
@ -24,7 +125,7 @@ Feature: webdav-related
Then the HTTP status code should be "507"
Scenario: Retrieving folder quota when no quota is set
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
When user "user0" has unlimited quota
@ -33,7 +134,7 @@ Feature: webdav-related
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"
Given using old dav path
And As an "admin"
And user "user0" exists
When user "user0" has a quota of "10 MB"
@ -42,7 +143,7 @@ Feature: webdav-related
And the single response should contain a property "{DAV:}quota-available-bytes" with value "10485421"
Scenario: Retrieving folder quota of shared folder with quota when no quota is set for recipient
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
@ -60,7 +161,7 @@ Feature: webdav-related
And the single response should contain a property "{DAV:}quota-available-bytes" with value "10485421"
Scenario: Uploading a file as recipient using webdav having quota
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
@ -78,7 +179,7 @@ Feature: webdav-related
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"
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user0" has a quota of "1 KB"
@ -88,7 +189,7 @@ Feature: webdav-related
Then the single response should contain a property "{DAV:}quota-available-bytes" with value "592"
Scenario: Retrieving folder quota when quota is set and a file was recieved
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
And user "user0" exists
And user "user1" exists
@ -118,7 +219,7 @@ Feature: webdav-related
Then Downloaded content should be "extcloud"
Scenario: Downloading a file on the old endpoint should serve security headers
Given using dav path "remote.php/webdav"
Given using old dav path
And As an "admin"
When Downloading file "/welcome.txt"
Then The following headers should be set
@ -255,7 +356,7 @@ Feature: webdav-related
| 3 |
Scenario: Upload chunked file asc with new chunking
Given using dav path "remote.php/dav"
Given using new dav path
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"
@ -263,11 +364,11 @@ Feature: webdav-related
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"
And Downloading file "/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"
Scenario: Upload chunked file desc with new chunking
Given using dav path "remote.php/dav"
Given using new dav path
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"
@ -275,11 +376,11 @@ Feature: webdav-related
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"
And Downloading file "/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"
Scenario: Upload chunked file random with new chunking
Given using dav path "remote.php/dav"
Given using new dav path
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"
@ -287,7 +388,7 @@ Feature: webdav-related
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"
And Downloading file "/myChunkedFile.txt"
Then Downloaded content should be "AAAAABBBBBCCCCC"
Scenario: A disabled user cannot use webdav