From e392f669c09a520e64ea82b7d22350871a05e089 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma <roeland@famdouma.nl> Date: Thu, 15 Sep 2016 12:41:39 +0200 Subject: [PATCH] Make OCS intergration tests check for CSP * Very hacky in simple test but at least we test --- .../features/bootstrap/Sharing.php | 23 +++++++++++++++++++ build/integration/features/sharing-v1.feature | 2 ++ 2 files changed, 25 insertions(+) diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 3a50b1917aa..a4a9b846cf4 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -514,5 +514,28 @@ trait Sharing { throw new \Exception('Expected the same link share to be returned'); } } + + /** + * @Then The following headers should be set + * @param \Behat\Gherkin\Node\TableNode $table + * @throws \Exception + */ + public function theFollowingHeadersShouldBeSet(\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 + ) + ); + } + } + } } diff --git a/build/integration/features/sharing-v1.feature b/build/integration/features/sharing-v1.feature index edd599da555..3c769fba3df 100644 --- a/build/integration/features/sharing-v1.feature +++ b/build/integration/features/sharing-v1.feature @@ -13,6 +13,8 @@ Feature: sharing | shareType | 0 | Then the OCS status code should be "100" And the HTTP status code should be "200" + And The following headers should be set + | Content-Security-Policy | default-src 'none' | Scenario: Creating a share with a group Given user "user0" exists -- GitLab