diff options
author | Joas Schilling <coding@schilljs.com> | 2016-08-17 10:23:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-17 10:23:13 +0200 |
commit | 027069cbae9e67a205c77095be09bac9a75bfa2a (patch) | |
tree | 78a2af1e3e7d8f2b9038a3d64a309303f3804610 /build | |
parent | c1632c3abd0f136b4ecb8d7a5bef5c3c72f9cb95 (diff) | |
parent | 77542817d1bfb260c4bff74f77b9507b699f1d76 (diff) | |
download | nextcloud-server-027069cbae9e67a205c77095be09bac9a75bfa2a.tar.gz nextcloud-server-027069cbae9e67a205c77095be09bac9a75bfa2a.zip |
Merge pull request #846 from nextcloud/provisioning_api_ocs
Move Provisioning API to the AppFramework
Diffstat (limited to 'build')
-rw-r--r-- | build/integration/features/bootstrap/BasicStructure.php | 7 | ||||
-rw-r--r-- | build/integration/features/bootstrap/Provisioning.php | 79 |
2 files changed, 77 insertions, 9 deletions
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); |