From dd9f195afd242c3d6023e8b6afecb73a61a99d60 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Mon, 1 Aug 2016 08:33:49 +0200 Subject: [PATCH] Add OCS-APIREQUEST header to intergration test calls --- .../features/bootstrap/BasicStructure.php | 3 +++ .../features/bootstrap/CommentsContext.php | 3 +++ .../features/bootstrap/Sharing.php | 26 ++++++++++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 80f24c6860b..0b0e5998c4b 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -157,6 +157,9 @@ trait BasicStructure { } else { $options['auth'] = [$this->currentUser, $this->regularUser]; } + $options['headers'] = [ + 'OCS_APIREQUEST' => 'true' + ]; if ($body instanceof \Behat\Gherkin\Node\TableNode) { $fd = $body->getRowsHash(); $options['body'] = $fd; diff --git a/build/integration/features/bootstrap/CommentsContext.php b/build/integration/features/bootstrap/CommentsContext.php index 5c3b0edafac..1d1b47f9736 100644 --- a/build/integration/features/bootstrap/CommentsContext.php +++ b/build/integration/features/bootstrap/CommentsContext.php @@ -191,6 +191,9 @@ class CommentsContext implements \Behat\Behat\Context\Context { $options['auth'] = [$user, '123456']; $fd = $body->getRowsHash(); $options['body'] = $fd; + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $client->send($client->createRequest($verb, $this->baseUrl.'/ocs/v1.php/'.$url, $options)); } diff --git a/build/integration/features/bootstrap/Sharing.php b/build/integration/features/bootstrap/Sharing.php index 954c273bfc2..3a50b1917aa 100644 --- a/build/integration/features/bootstrap/Sharing.php +++ b/build/integration/features/bootstrap/Sharing.php @@ -52,7 +52,11 @@ trait Sharing { public function asCreatingAShareWith($user, $body) { $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; $client = new Client(); - $options = []; + $options = [ + 'headers' => [ + 'OCS-APIREQUEST' => 'true', + ], + ]; if ($user === 'admin') { $options['auth'] = $this->adminUser; } else { @@ -160,7 +164,11 @@ trait Sharing { $share_id = (string) $this->lastShareData->data[0]->id; $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares/$share_id"; $client = new Client(); - $options = []; + $options = [ + 'headers' => [ + 'OCS-APIREQUEST' => 'true', + ], + ]; if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } else { @@ -194,7 +202,11 @@ trait Sharing { $permissions = null){ $fullUrl = $this->baseUrl . "v{$this->apiVersion}.php/apps/files_sharing/api/v{$this->sharingApiVersion}/shares"; $client = new Client(); - $options = []; + $options = [ + 'headers' => [ + 'OCS-APIREQUEST' => 'true', + ], + ]; if ($user === 'admin') { $options['auth'] = $this->adminUser; @@ -335,6 +347,9 @@ trait Sharing { } else { $options['auth'] = [$user1, $this->regularUser]; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); if ($this->isUserOrGroupInSharedData($user2, $permissions)){ return; @@ -361,6 +376,9 @@ trait Sharing { } else { $options['auth'] = [$user, $this->regularUser]; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); if ($this->isUserOrGroupInSharedData($group, $permissions)){ return; @@ -448,6 +466,7 @@ trait Sharing { ], 'headers' => [ 'Content-Type' => 'application/json', + 'OCS-APIREQUEST' => 'true', ], ] ); @@ -465,6 +484,7 @@ trait Sharing { ], 'headers' => [ 'Content-Type' => 'application/json', + 'OCS-APIREQUEST' => 'true', ], ] ); -- 2.39.5