]> source.dussan.org Git - nextcloud-server.git/commitdiff
Make OCS intergration tests check for CSP 1417/head
authorRoeland Jago Douma <roeland@famdouma.nl>
Thu, 15 Sep 2016 10:41:39 +0000 (12:41 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Thu, 15 Sep 2016 11:11:36 +0000 (13:11 +0200)
* Very hacky in simple test but at least we test

build/integration/features/bootstrap/Sharing.php
build/integration/features/sharing-v1.feature

index 3a50b1917aaed84fafc26cebde61cc40e0cd4484..a4a9b846cf42d0be83c5b61077ee9a37fd91601f 100644 (file)
@@ -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
+                                       )
+                               );
+                       }
+               }
+       }
 }
 
index edd599da555c5af8dce36a016c050b281b6a76fc..3c769fba3dff9675d92866e758d7de9933924c4e 100644 (file)
@@ -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