summaryrefslogtreecommitdiffstats
path: root/build/integration/features/bootstrap
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-12-14 17:35:27 +0100
committerLukas Reschke <lukas@statuscode.ch>2016-12-14 17:35:27 +0100
commit8a00638425de4016cd86b5e1b9e0b3ac193eb7e6 (patch)
treec3059705b8a6dc67d5654cc2e6287056532f839f /build/integration/features/bootstrap
parente1b806467c19f85af975fcbc9793a730614c2963 (diff)
downloadnextcloud-server-8a00638425de4016cd86b5e1b9e0b3ac193eb7e6.tar.gz
nextcloud-server-8a00638425de4016cd86b5e1b9e0b3ac193eb7e6.zip
Don't set Content-Disposition header if one already exists
If a Content-Disposition header is already set by another plugin we don't need to set another one as this breaks clients. Fixes https://github.com/nextcloud/server/issues/1992 Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'build/integration/features/bootstrap')
-rw-r--r--build/integration/features/bootstrap/CardDavContext.php111
1 files changed, 111 insertions, 0 deletions
diff --git a/build/integration/features/bootstrap/CardDavContext.php b/build/integration/features/bootstrap/CardDavContext.php
index bfdd51bfdb0..4ee882cc2e6 100644
--- a/build/integration/features/bootstrap/CardDavContext.php
+++ b/build/integration/features/bootstrap/CardDavContext.php
@@ -202,4 +202,115 @@ class CardDavContext implements \Behat\Behat\Context\Context {
}
}
+ /**
+ * @Given :user uploads the contact :fileName to the addressbook :addressbook
+ */
+ public function uploadsTheContactToTheAddressbook($user, $fileName, $addressBook) {
+ $davUrl = $this->baseUrl . '/remote.php/dav/addressbooks/users/'.$user.'/'.$addressBook . '/' . $fileName;
+ $password = ($user === 'admin') ? 'admin' : '123456';
+
+ $request = $this->client->createRequest(
+ 'PUT',
+ $davUrl,
+ [
+ 'body' => file_get_contents(__DIR__ . '/../../data/' . $fileName),
+ 'auth' => [
+ $user,
+ $password,
+ ],
+ 'headers' => [
+ 'Content-Type' => 'application/xml;charset=UTF-8',
+ ],
+ ]
+ );
+
+ $this->response = $this->client->send($request);
+
+ if($this->response->getStatusCode() !== 201) {
+ throw new \Exception(
+ sprintf(
+ 'Expected %s got %s',
+ 201,
+ $this->response->getStatusCode()
+ )
+ );
+ }
+ }
+
+ /**
+ * @When Exporting the picture of contact :fileName from addressbook :addressBook as user :user
+ */
+ public function whenExportingThePictureOfContactFromAddressbookAsUser($fileName, $addressBook, $user) {
+ $davUrl = $this->baseUrl . '/remote.php/dav/addressbooks/users/'.$user.'/'.$addressBook . '/' . $fileName . '?photo=true';
+ $password = ($user === 'admin') ? 'admin' : '123456';
+
+ try {
+ $request = $this->client->createRequest(
+ 'GET',
+ $davUrl,
+ [
+ 'auth' => [
+ $user,
+ $password,
+ ],
+ 'headers' => [
+ 'Content-Type' => 'application/xml;charset=UTF-8',
+ ],
+ ]
+ );
+ $this->response = $this->client->send($request);
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ $this->response = $e->getResponse();
+ }
+ }
+
+ /**
+ * @When Downloading the contact :fileName from addressbook :addressBook as user :user
+ */
+ public function whenDownloadingTheContactFromAddressbookAsUser($fileName, $addressBook, $user) {
+ $davUrl = $this->baseUrl . '/remote.php/dav/addressbooks/users/'.$user.'/'.$addressBook . '/' . $fileName;
+ $password = ($user === 'admin') ? 'admin' : '123456';
+
+ try {
+ $request = $this->client->createRequest(
+ 'GET',
+ $davUrl,
+ [
+ 'auth' => [
+ $user,
+ $password,
+ ],
+ 'headers' => [
+ 'Content-Type' => 'application/xml;charset=UTF-8',
+ ],
+ ]
+ );
+ $this->response = $this->client->send($request);
+ } catch (\GuzzleHttp\Exception\ClientException $e) {
+ $this->response = $e->getResponse();
+ }
+ }
+
+ /**
+ * @Then The following HTTP headers should be set
+ * @param \Behat\Gherkin\Node\TableNode $table
+ * @throws \Exception
+ */
+ public function theFollowingHttpHeadersShouldBeSet(\Behat\Gherkin\Node\TableNode $table) {
+ foreach($table->getTable() as $header) {
+ $headerName = $header[0];
+ $expectedHeaderValue = $header[1];
+ $returnedHeader = $this->response->getHeader($headerName);
+ if($returnedHeader !== $expectedHeaderValue) {
+ throw new \Exception(
+ sprintf(
+ "Expected value '%s' for header '%s', got '%s'",
+ $expectedHeaderValue,
+ $headerName,
+ $returnedHeader
+ )
+ );
+ }
+ }
+ }
}