diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-11-22 20:24:36 +0300 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-11-28 12:27:38 +0300 |
commit | 505c5c3bb5712da281c93481c6ef7fb5aa43cab4 (patch) | |
tree | 7ed676d6269e83275ccd0aa53c0c83d1c59b3eb9 | |
parent | f418d55ffc8a363c18c216ea6ec11ca6294d83db (diff) |
Add test for duplicate 401 headers on DAV
-rw-r--r-- | build/integration/features/bootstrap/WebDav.php | 24 | ||||
-rw-r--r-- | build/integration/features/webdav-related.feature | 16 |
2 files changed, 40 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/WebDav.php b/build/integration/features/bootstrap/WebDav.php index 8cbfeb90efa..069f933ffc5 100644 --- a/build/integration/features/bootstrap/WebDav.php +++ b/build/integration/features/bootstrap/WebDav.php @@ -617,4 +617,28 @@ trait WebDav { $this->asGetsPropertiesOfFolderWith($user, NULL, $path, $propertiesTable); PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]); } + + /** + * @When Connecting to dav endpoint + */ + public function connectingToDavEndpoint() { + try { + $this->response = $this->makeDavRequest(null, 'PROPFIND', '', []); + } catch (\GuzzleHttp\Exception\ClientException $e) { + $this->response = $e->getResponse(); + } + } + + /** + * @Then there are no duplicate headers + */ + public function thereAreNoDuplicateHeaders() { + $headers = $this->response->getHeaders(); + foreach ($headers as $headerName => $headerValues) { + // if a header has multiple values, they must be different + if (count($headerValues) > 1 && count(array_unique($headerValues)) < count($headerValues)) { + throw new \Exception('Duplicate header found: ' . $headerName); + } + } + } } diff --git a/build/integration/features/webdav-related.feature b/build/integration/features/webdav-related.feature index 98b6351dbdf..c1ee5966fac 100644 --- a/build/integration/features/webdav-related.feature +++ b/build/integration/features/webdav-related.feature @@ -2,6 +2,22 @@ Feature: webdav-related Background: Given using api version "1" + Scenario: Unauthenticated call old dav path + Given using dav path "remote.php/webdav" + When connecting to dav endpoint + Then the HTTP status code should be "401" + And there are no duplicate headers + And The following headers should be set + |WWW-Authenticate|Basic realm="ownCloud"| + + Scenario: Unauthenticated call new dav path + Given using dav path "remote.php/dav" + When connecting to dav endpoint + Then the HTTP status code should be "401" + And there are no duplicate headers + And The following headers should be set + |WWW-Authenticate|Basic realm="ownCloud"| + Scenario: Moving a file Given using old dav path And As an "admin" |