diff --git a/tests/Integration/features/author.feature b/tests/Integration/features/author.feature index b9da59b3..73d415b0 100644 --- a/tests/Integration/features/author.feature +++ b/tests/Integration/features/author.feature @@ -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 diff --git a/tests/Integration/features/bootstrap/WebDav.php b/tests/Integration/features/bootstrap/WebDav.php index bdd73ac0..797928f4 100644 --- a/tests/Integration/features/bootstrap/WebDav.php +++ b/tests/Integration/features/bootstrap/WebDav.php @@ -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$/ */ @@ -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 = ' @@ -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 = ' + + + ' . $properties . ' + + '; + + $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 diff --git a/tests/Integration/features/sharing-user.feature b/tests/Integration/features/sharing-user.feature index e30a9167..cdb66a13 100644 --- a/tests/Integration/features/sharing-user.feature +++ b/tests/Integration/features/sharing-user.feature @@ -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 @@ -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 | @@ -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 "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"