From: Roeland Jago Douma Date: Fri, 12 Aug 2016 08:46:33 +0000 (+0200) Subject: Fix intergration tests X-Git-Tag: v11.0RC2~821^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=77542817d1bfb260c4bff74f77b9507b699f1d76;p=nextcloud-server.git Fix intergration tests * Set OCS-APIREQUEST: true * PUT requires a body --- diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php index 0b0e5998c4b..e9e20c047aa 100644 --- a/build/integration/features/bootstrap/BasicStructure.php +++ b/build/integration/features/bootstrap/BasicStructure.php @@ -165,6 +165,13 @@ trait BasicStructure { $options['body'] = $fd; } + // TODO: Fix this hack! + if ($verb === 'PUT' && $body === null) { + $options['body'] = [ + 'foo' => 'bar', + ]; + } + try { $this->response = $client->send($client->createRequest($verb, $fullUrl, $options)); } catch (\GuzzleHttp\Exception\ClientException $ex) { diff --git a/build/integration/features/bootstrap/Provisioning.php b/build/integration/features/bootstrap/Provisioning.php index bc3fc9a4c4a..dbdfafcecdc 100644 --- a/build/integration/features/bootstrap/Provisioning.php +++ b/build/integration/features/bootstrap/Provisioning.php @@ -96,9 +96,12 @@ trait Provisioning { } $options['body'] = [ - 'userid' => $user, - 'password' => '123456' - ]; + 'userid' => $user, + 'password' => '123456' + ]; + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->send($client->createRequest("POST", $fullUrl, $options)); if ($this->currentServer === 'LOCAL'){ @@ -111,6 +114,9 @@ trait Provisioning { $options2 = [ 'auth' => [$user, '123456'], ]; + $options2['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $url = $fullUrl.'/'.$user; $client->send($client->createRequest('GET', $url, $options2)); } @@ -152,6 +158,9 @@ trait Provisioning { $client = new Client(); $options = []; $options['auth'] = $this->adminUser; + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true' + ]; $this->response = $client->get($fullUrl, $options); } @@ -168,6 +177,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); $respondedArray = $this->getArrayOfGroupsResponded($this->response); @@ -183,6 +195,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); $respondedArray = $this->getArrayOfGroupsResponded($this->response); @@ -223,6 +238,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); $groups = array($group); @@ -244,8 +262,11 @@ trait Provisioning { } $options['body'] = [ - 'groupid' => $group, - ]; + 'groupid' => $group, + ]; + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->send($client->createRequest("POST", $fullUrl, $options)); if ($this->currentServer === 'LOCAL'){ @@ -265,6 +286,13 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; + // TODO: fix hack + $options['body'] = [ + 'foo' => 'bar' + ]; $this->response = $client->send($client->createRequest("PUT", $fullUrl, $options)); } @@ -280,6 +308,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->send($client->createRequest("DELETE", $fullUrl, $options)); } @@ -295,6 +326,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->send($client->createRequest("DELETE", $fullUrl, $options)); } @@ -323,10 +357,13 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $options['body'] = [ - 'groupid' => $group, - ]; + 'groupid' => $group, + ]; $this->response = $client->send($client->createRequest("POST", $fullUrl, $options)); } @@ -337,6 +374,9 @@ trait Provisioning { $client = new Client(); $options = []; $options['auth'] = $this->adminUser; + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); } @@ -394,6 +434,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); $respondedArray = $this->getArrayOfSubadminsResponded($this->response); @@ -415,8 +458,11 @@ trait Provisioning { $options['auth'] = $this->adminUser; } $options['body'] = [ - 'groupid' => $group - ]; + 'groupid' => $group + ]; + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->send($client->createRequest("POST", $fullUrl, $options)); PHPUnit_Framework_Assert::assertEquals(200, $this->response->getStatusCode()); } @@ -433,6 +479,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); $respondedArray = $this->getArrayOfSubadminsResponded($this->response); @@ -561,6 +610,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); $respondedArray = $this->getArrayOfAppsResponded($this->response); @@ -579,6 +631,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); $respondedArray = $this->getArrayOfAppsResponded($this->response); @@ -597,6 +652,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); PHPUnit_Framework_Assert::assertEquals("false", $this->response->xml()->data[0]->enabled); @@ -613,6 +671,9 @@ trait Provisioning { if ($this->currentUser === 'admin') { $options['auth'] = $this->adminUser; } + $options['headers'] = [ + 'OCS-APIREQUEST' => 'true', + ]; $this->response = $client->get($fullUrl, $options); PHPUnit_Framework_Assert::assertEquals("true", $this->response->xml()->data[0]->enabled);