diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-06-21 11:18:22 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-06-21 11:18:22 +0200 |
commit | 2b493e2f9dca674ba11f88a1d182d6872e04eaaa (patch) | |
tree | ef7fa75d1b4da812de80e93c3590dbb5404d7f06 /build | |
parent | b4df57f3f02f65ed71d1072280751170379a53e8 (diff) | |
parent | 0e575c7eeadc6c8eb11b0be2ed1d39cdcf6cfcb8 (diff) | |
download | nextcloud-server-2b493e2f9dca674ba11f88a1d182d6872e04eaaa.tar.gz nextcloud-server-2b493e2f9dca674ba11f88a1d182d6872e04eaaa.zip |
Merge remote-tracking branch 'upstream/master' into master-sync-upstream
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/composer.json | 2 | ||||
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 50 | ||||
-rw-r--r-- | build/integration/features/dav-v2.feature | 55 | ||||
-rw-r--r-- | build/integration/features/favorites.feature | 42 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 37 |
5 files changed, 146 insertions, 40 deletions
diff --git a/build/integration/composer.json b/build/integration/composer.json index 9e5335c4b24..29f73f2064a 100644 --- a/build/integration/composer.json +++ b/build/integration/composer.json @@ -4,6 +4,6 @@ "behat/behat": "^3.0", "guzzlehttp/guzzle": "~5.0", "jarnaiz/behat-junit-formatter": "^1.3", - "sabre/dav": "3.0.x-dev" + "sabre/dav": "3.0.9" } } diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index cd9584ad186..0abb8667739 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -214,7 +214,7 @@ trait WebDav { } $value = $keys[$key]; - if ($value !== $expectedValue) { + if ($value != $expectedValue) { throw new \Exception("Property \"$key\" found with value \"$value\", expected \"$expectedValue\""); } } @@ -434,5 +434,51 @@ trait WebDav { $this->response = $ex->getResponse(); } } -} + /** + * @When user :user favorites element :path + */ + public function userFavoritesElement($user, $path){ + $this->response = $this->changeFavStateOfAnElement($user, $path, 1, 0, null); + } + + /** + * @When user :user unfavorites element :path + */ + public function userUnfavoritesElement($user, $path){ + $this->response = $this->changeFavStateOfAnElement($user, $path, 0, 0, null); + } + + /*Set the elements of a proppatch, $folderDepth requires 1 to see elements without children*/ + public function changeFavStateOfAnElement($user, $path, $favOrUnfav, $folderDepth, $properties = null){ + $fullUrl = substr($this->baseUrl, 0, -4); + $settings = array( + 'baseUri' => $fullUrl, + 'userName' => $user, + ); + if ($user === 'admin') { + $settings['password'] = $this->adminUser[1]; + } else { + $settings['password'] = $this->regularUser; + } + $client = new SClient($settings); + if (!$properties) { + $properties = [ + '{http://owncloud.org/ns}favorite' => $favOrUnfav + ]; + } + + $response = $client->proppatch($this->davPath . '/' . ltrim($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); + } +} diff --git a/build/integration/features/dav-v2.feature b/build/integration/features/dav-v2.feature new file mode 100644 index 00000000000..2b3aeff9454 --- /dev/null +++ b/build/integration/features/dav-v2.feature @@ -0,0 +1,55 @@ +Feature: dav-v2 + Background: + Given using api version "1" + + Scenario: moving a file new endpoint way + Given using dav path "remote.php/dav" + And As an "admin" + And user "user0" exists + When User "user0" moves file "/files/user0/textfile0.txt" to "/files/user0/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" + And As an "admin" + And user "user0" exists + And As an "user0" + When Downloading file "/files/user0/welcome.txt" with range "bytes=51-77" + 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/" + And As an "admin" + 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';| + |X-Content-Type-Options |nosniff| + |X-Download-Options|noopen| + |X-Frame-Options|Sameorigin| + |X-Permitted-Cross-Domain-Policies|none| + |X-Robots-Tag|none| + |X-XSS-Protection|1; mode=block| + And Downloaded content should start with "Welcome to your ownCloud account!" + + Scenario: Doing a GET with a web login should work without CSRF token on the new backend + Given Logging in using web as "admin" + When Sending a "GET" to "/remote.php/dav/files/admin/welcome.txt" without requesttoken + Then Downloaded content should start with "Welcome to your ownCloud account!" + Then the HTTP status code should be "200" + + Scenario: Doing a GET with a web login should work with CSRF token on the new backend + Given Logging in using web as "admin" + When Sending a "GET" to "/remote.php/dav/files/admin/welcome.txt" with requesttoken + Then Downloaded content should start with "Welcome to your ownCloud account!" + Then the HTTP status code should be "200" + + Scenario: Doing a PROPFIND with a web login should not work without CSRF token on the new backend + Given Logging in using web as "admin" + When Sending a "PROPFIND" to "/remote.php/dav/files/admin/welcome.txt" without requesttoken + Then the HTTP status code should be "401" + + Scenario: Doing a PROPFIND with a web login should work with CSRF token on the new backend + Given Logging in using web as "admin" + When Sending a "PROPFIND" to "/remote.php/dav/files/admin/welcome.txt" with requesttoken + Then the HTTP status code should be "207" diff --git a/build/integration/features/favorites.feature b/build/integration/features/favorites.feature new file mode 100644 index 00000000000..86643fdd1e2 --- /dev/null +++ b/build/integration/features/favorites.feature @@ -0,0 +1,42 @@ +Feature: favorite + Background: + Given using api version "1" + + Scenario: Favorite a folder + Given using dav path "remote.php/webdav" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/FOLDER" + Then as "user0" gets properties of folder "/FOLDER" with + |{http://owncloud.org/ns}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" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/FOLDER" + And user "user0" unfavorites element "/FOLDER" + Then as "user0" gets properties of folder "/FOLDER" with + |{http://owncloud.org/ns}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" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/textfile0.txt" + Then as "user0" gets properties of file "/textfile0.txt" with + |{http://owncloud.org/ns}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" + And As an "admin" + And user "user0" exists + When user "user0" favorites element "/textfile0.txt" + And user "user0" unfavorites element "/textfile0.txt" + Then as "user0" gets properties of file "/textfile0.txt" with + |{http://owncloud.org/ns}favorite| + And the single response should contain a property "{http://owncloud.org/ns}favorite" with value "" + diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index 14ff505463c..06df280ea64 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -92,43 +92,6 @@ Feature: webdav-related |X-XSS-Protection|1; mode=block| And Downloaded content should start with "Welcome to your ownCloud account!" - Scenario: Downloading a file on the new endpoint should serve security headers - Given using dav path "remote.php/dav/files/admin/" - And As an "admin" - 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';| - |X-Content-Type-Options |nosniff| - |X-Download-Options|noopen| - |X-Frame-Options|Sameorigin| - |X-Permitted-Cross-Domain-Policies|none| - |X-Robots-Tag|none| - |X-XSS-Protection|1; mode=block| - And Downloaded content should start with "Welcome to your ownCloud account!" - - Scenario: Doing a GET with a web login should work without CSRF token on the new backend - Given Logging in using web as "admin" - When Sending a "GET" to "/remote.php/dav/files/admin/welcome.txt" without requesttoken - Then Downloaded content should start with "Welcome to your ownCloud account!" - Then the HTTP status code should be "200" - - Scenario: Doing a GET with a web login should work with CSRF token on the new backend - Given Logging in using web as "admin" - When Sending a "GET" to "/remote.php/dav/files/admin/welcome.txt" with requesttoken - Then Downloaded content should start with "Welcome to your ownCloud account!" - Then the HTTP status code should be "200" - - Scenario: Doing a PROPFIND with a web login should not work without CSRF token on the new backend - Given Logging in using web as "admin" - When Sending a "PROPFIND" to "/remote.php/dav/files/admin/welcome.txt" without requesttoken - Then the HTTP status code should be "401" - - Scenario: Doing a PROPFIND with a web login should work with CSRF token on the new backend - Given Logging in using web as "admin" - When Sending a "PROPFIND" to "/remote.php/dav/files/admin/welcome.txt" with requesttoken - Then the HTTP status code should be "207" - Scenario: Doing a GET with a web login should work without CSRF token on the old backend Given Logging in using web as "admin" When Sending a "GET" to "/remote.php/webdav/welcome.txt" without requesttoken |