Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable9.1] Add test for duplicate 401 headers on DAV #26711

Merged
merged 1 commit into from
Nov 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions build/integration/features/bootstrap/WebDav.php
Original file line number Diff line number Diff line change
Expand Up @@ -618,4 +618,27 @@ public function checkIfETAGHasChanged($path, $user){
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);
}
}
}
}
16 changes: 16 additions & 0 deletions build/integration/features/webdav-related.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ Feature: webdav-related
Background:
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
Given using old dav path
And As an "admin"
Expand Down