Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/Integration/features/author.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ Feature: Author
| checks-0 | {"class":"OCA\\\\WorkflowEngine\\\\Check\\\\FileName","operator":"is","value":"foobar.txt"} |
And as user "test1"
When Downloading file "/foobar.txt"
Then The webdav response should have a status code "404"
Then The webdav response should have a status code "403"
When Downloading file "/foobar.txt" with range "1-4"
Then The webdav response should have a status code "404"
Then The webdav response should have a status code "403"
Then User "test1" sees no files in the trashbin

Scenario: Updating file is blocked
Expand Down
34 changes: 31 additions & 3 deletions tests/Integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,15 @@ public function checkPropForFile($file, $prefix, $prop, $value) {
Assert::assertEquals($value, $property);
}

/**
* @Then /^Propfind for file "([^"]*)" prop "([^"]*):([^"]*)" fails with ([0-9]+) "([^"]*)"$/
*/
public function checkPropForFileFails(string $file, string $prefix, string $prop, int $status, string $message): void {
$this->propfindFileFailed($this->currentUser, $file, "<$prefix:$prop/>");
Assert::assertEquals($status, $this->response['statusCode']);
Assert::assertStringContainsString($message, $this->response['body']);
}

/**
* @Then /^Image search should work$/
*/
Expand Down Expand Up @@ -404,11 +413,10 @@ public function listFolder($user, $path, $folderDepth, $properties = null) {
}

/**
* Returns the elements of a profind command
* Returns the elements of a propfind command
* @param string $properties properties which needs to be included in the report
* @param string $filterRules filter-rules to choose what needs to appear in the report
*/
public function propfindFile(string $user, string $path, string $properties = '') {
public function propfindFile(string $user, string $path, string $properties = ''): array {
$client = $this->getSabreClient($user);

$body = '<?xml version="1.0" encoding="utf-8" ?>
Expand All @@ -426,6 +434,26 @@ public function propfindFile(string $user, string $path, string $properties = ''
return $parsedResponse;
}

/**
* Returns the elements of a propfind command
* @param string $properties properties which needs to be included in the report
*/
public function propfindFileFailed(string $user, string $path, string $properties = ''): void {
$client = $this->getSabreClient($user);

$body = '<?xml version="1.0" encoding="utf-8" ?>
<d:propfind xmlns:d="DAV:"
xmlns:oc="http://owncloud.org/ns"
xmlns:nc="http://nextcloud.org/ns"
xmlns:ocs="http://open-collaboration-services.org/ns">
<d:prop>
' . $properties . '
</d:prop>
</d:propfind>';

$this->response = $client->request('PROPFIND', $this->makeSabrePath($user, $path), $body);
}

/**
* Returns the elements of a search command
* @param string $properties properties which needs to be included in the report
Expand Down
10 changes: 5 additions & 5 deletions tests/Integration/features/sharing-user.feature
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Feature: Sharing user
| operation | deny |
| checks-0 | {"class":"OCA\\\\WorkflowEngine\\\\Check\\\\FileSystemTags", "operator": "is", "value": "{{{FILES_ACCESSCONTROL_INTEGRATIONTEST_TAGID}}}"} |
Then Downloading file "/nextcloud2.txt" as "test2"
And The webdav response should have a status code "404"
And The webdav response should have a status code "403"
And Downloading file "/nextcloud3.txt" as "test2"
And The webdav response should have a status code "200"
And user "test2" should see following elements
Expand Down Expand Up @@ -169,7 +169,7 @@ Feature: Sharing user
Then Downloading file "/nextcloud2.txt" as "test2"
And The webdav response should have a status code "200"
And Downloading file "/nextcloud3.txt" as "test2"
And The webdav response should have a status code "404"
And The webdav response should have a status code "403"
And user "test2" should see following elements
| /nextcloud2.txt |

Expand Down Expand Up @@ -197,10 +197,10 @@ Feature: Sharing user
| operation | deny |
| checks-0 | {"class":"OCA\\\\WorkflowEngine\\\\Check\\\\FileMimeType", "operator": "is", "value": "text/plain"} |
And as user "test2"
When File "/foobar.txt" should have prop "oc:permissions" equal to "SRD"
When Propfind for file "/foobar.txt" prop "oc:permissions" fails with 403 "<s:message>No read permissions."
When Downloading file "/foobar.txt"
Then The webdav response should have a status code "404"
Then The webdav response should have a status code "403"
When Downloading file "/foobar.txt" with range "1-4"
Then The webdav response should have a status code "404"
Then The webdav response should have a status code "403"
When Downloading last public shared file with range "1-4"
Then The webdav response should have a status code "404"
Loading