Add test for duplicate 401 headers on DAV
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
parent
2ae15ad37b
commit
734e55da95
|
@ -656,4 +656,28 @@ trait WebDav {
|
||||||
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
|
$this->asGetsPropertiesOfFolderWith($user, 'entry', $path, $propertiesTable);
|
||||||
PHPUnit_Framework_Assert::assertNotEquals($this->response['{DAV:}getetag'], $this->storedETAG[$user][$path]);
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,22 @@ Feature: webdav-related
|
||||||
Background:
|
Background:
|
||||||
Given using api version "1"
|
Given using api version "1"
|
||||||
|
|
||||||
|
Scenario: Unauthenticated call old dav path
|
||||||
|
Given using old dav path
|
||||||
|
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 new dav path
|
||||||
|
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
|
Scenario: Moving a file
|
||||||
Given using old dav path
|
Given using old dav path
|
||||||
And As an "admin"
|
And As an "admin"
|
||||||
|
|
Loading…
Reference in New Issue