diff --git a/tests/acceptance/features/apiWebdav/webdav-related.feature b/tests/acceptance/features/apiWebdav/webdav-related.feature index 91ed4be24a42..8aa0c056be8d 100644 --- a/tests/acceptance/features/apiWebdav/webdav-related.feature +++ b/tests/acceptance/features/apiWebdav/webdav-related.feature @@ -165,6 +165,16 @@ Feature: webdav-related | old | | new | + Scenario Outline: download a file + Given using DAV path + And user "user0" has been created + When user "user0" downloads the file "/textfile0.txt" using the API + Then the downloaded content should be "ownCloud test text file" plus end-of-line + Examples: + | dav_version | + | old | + | new | + Scenario Outline: download a file with range Given using DAV path And user "user0" has been created @@ -175,6 +185,110 @@ Feature: webdav-related | old | | new | + Scenario Outline: upload a file and check download content + Given using DAV path + And user "user0" has been created + When user "user0" uploads file with content "uploaded content" to "" using the API + Then the content of file "" for user "user0" should be "uploaded content" + Examples: + | dav_version | file_name | + | old | /upload.txt | + | old | /strängé file.txt | + | old | /C++ file.cpp | + | old | /नेपाली.txt | + | old | /file #2.txt | + | old | /file ?2.txt | + | new | /upload.txt | + | new | /strängé file.txt | + | new | /C++ file.cpp | + | new | /नेपाली.txt | + | new | /file #2.txt | + | new | /file ?2.txt | + + Scenario Outline: create a folder + Given using DAV path + And user "user0" has been created + When user "user0" creates a folder "" using the API + Then as "user0" the folder "" should exist + Examples: + | dav_version | folder_name | + | old | /upload | + | old | /strängé folder | + | old | /C++ folder.cpp | + | old | /नेपाली | + | old | /folder #2 | + | old | /folder ?2 | + | new | /upload | + | new | /strängé folder | + | new | /C++ folder.cpp | + | new | /नेपाली | + | new | /folder #2 | + | new | /folder ?2 | + + Scenario Outline: upload a file into a folder and check download content + Given using DAV path + And user "user0" has been created + And user "user0" has created a folder "" + When user "user0" uploads file with content "uploaded content" to "/" using the API + Then the content of file "/" for user "user0" should be "uploaded content" + Examples: + | dav_version | folder_name | file_name | + | old | /upload | abc.txt | + | old | /strängé folder | strängé file.txt | + | old | /C++ folder | C++ file.cpp | + | old | /नेपाली | नेपाली | + | old | /folder #2.txt | file #2.txt | + | old | /folder ?2.txt | file ?2.txt | + | new | /upload | abc.txt | + | new | /strängé folder (duplicate #2 &) | strängé file (duplicate #2 &) | + | new | /C++ folder | C++ file.cpp | + | new | /नेपाली | नेपाली | + | new | /folder #2.txt | file #2.txt | + | new | /folder ?2.txt | file ?2.txt | + + Scenario Outline: Do a PROPFIND of various file names + Given using DAV path + And user "user0" has been created + And user "user0" has uploaded file with content "uploaded content" to "" + When user "user0" gets the properties of file "" using the API + Then the properties response should contain an etag + Examples: + | dav_version | file_name | + | old | /upload.txt | + | old | /strängé file.txt | + | old | /C++ file.cpp | + | old | /नेपाली.txt | + | old | /file #2.txt | + | old | /file ?2.txt | + | new | /upload.txt | + | new | /strängé file.txt | + | new | /C++ file.cpp | + | new | /नेपाली.txt | + | new | /file #2.txt | + | new | /file ?2.txt | + + Scenario Outline: Do a PROPFIND of various folder/file names + Given using DAV path + And user "user0" has been created + And user "user0" has created a folder "" + And user "user0" has uploaded file with content "uploaded content" to "/" + When user "user0" gets the properties of file "/" using the API + Then the properties response should contain an etag + Examples: + | dav_version | folder_name | file_name | + | old | /upload | abc.txt | + | old | /strängé folder | strängé file.txt | + | old | /C++ folder | C++ file.cpp | + | old | /नेपाली | नेपाली | + | old | /folder #2.txt | file #2.txt | + | old | /folder ?2.txt | file ?2.txt | + | new | /upload | abc.txt | + | new | /strängé folder (duplicate #2 &) | strängé file (duplicate #2 &) | + | new | /C++ folder | C++ file.cpp | + | new | /नेपाली | नेपाली | + | new | /folder #2.txt | file #2.txt | + | new | /folder ?2.txt | file ?2.txt | + Scenario Outline: Retrieving folder quota when no quota is set Given using DAV path And user "user0" has been created diff --git a/tests/acceptance/features/bootstrap/WebDav.php b/tests/acceptance/features/bootstrap/WebDav.php index 1a2f8b241c51..b0f94c17f290 100644 --- a/tests/acceptance/features/bootstrap/WebDav.php +++ b/tests/acceptance/features/bootstrap/WebDav.php @@ -427,6 +427,19 @@ public function downloadedContentShouldBe($content) { ); } + /** + * @Then /^the downloaded content should be "([^"]*)" plus end-of-line$/ + * + * @param string $fileName + * @param string $user + * @param string $content + * + * @return void + */ + public function downloadedContentShouldBePlusEndOfLine($content) { + $this->downloadedContentShouldBe($content . "\n"); + } + /** * @Then /^the content of file "([^"]*)" should be "([^"]*)"$/ * @@ -575,6 +588,22 @@ public function downloadedContentShouldStartWith($start) { } } + /** + * @When /^user "([^"]*)" gets the properties of (?:file|folder|entry) "([^"]*)" using the API$/ + * + * @param string $user + * @param string $path + * + * @return void + */ + public function userGetsThePropertiesOfFolder( + $user, $path + ) { + $this->response = $this->listFolder( + $user, $path, 0, [] + ); + } + /** * @When /^user "([^"]*)" gets the following properties of (?:file|folder|entry) "([^"]*)" using the API$/ * @@ -699,13 +728,33 @@ public function asTheFileOrFolderShouldNotExist($user, $entry, $path) { */ public function asTheFileOrFolderShouldExist($user, $entry, $path) { $this->response = $this->listFolder($user, $path, 0); - if (!\is_array($this->response) || !isset($this->response['{DAV:}getetag'])) { + try { + $this->thePropertiesResponseShouldContainAnEtag(); + } catch (\Exception $e) { throw new \Exception( $entry . ' "' . $path . '" expected to exist but not found' ); } } + /** + * @Then /^the properties response should contain an etag$/ + * + * @param string $user + * @param string $entry + * @param string $path + * + * @return void + * @throws \Exception + */ + public function thePropertiesResponseShouldContainAnEtag() { + if (!\is_array($this->response) || !isset($this->response['{DAV:}getetag'])) { + throw new \Exception( + "getetag not found in response" + ); + } + } + /** * @Then the single response should contain a property :key with value :value *