summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2016-02-25 19:05:05 +0100
committerLukas Reschke <lukas@owncloud.com>2016-02-25 19:05:05 +0100
commit0e19c6a3a0cdd92b9484ac1ebb7907dc81ec9ed6 (patch)
tree46597ccbe957283134b1258926a4ea9089ac179f
parent3772a8acdb611b441bf2ea4fa3e0a37110a9d69f (diff)
downloadnextcloud-server-0e19c6a3a0cdd92b9484ac1ebb7907dc81ec9ed6.tar.gz
nextcloud-server-0e19c6a3a0cdd92b9484ac1ebb7907dc81ec9ed6.zip
Fix formatting of response
The elements are expected to be within a `service` array as per specification.
-rw-r--r--ocs-provider/provider.php6
-rw-r--r--tests/ocs-provider/provider.php110
2 files changed, 62 insertions, 54 deletions
diff --git a/ocs-provider/provider.php b/ocs-provider/provider.php
index 921362b9e50..396b5b23fc6 100644
--- a/ocs-provider/provider.php
+++ b/ocs-provider/provider.php
@@ -40,7 +40,6 @@ class Provider extends \OCP\AppFramework\Controller {
*/
public function buildProviderList() {
$services = [
- 'version' => 2,
'PRIVATE_DATA' => [
'version' => 1,
'endpoints' => [
@@ -87,6 +86,9 @@ class Provider extends \OCP\AppFramework\Controller {
];
}
- return new \OCP\AppFramework\Http\JSONResponse($services);
+ return new \OCP\AppFramework\Http\JSONResponse([
+ 'version' => 2,
+ 'services' => $services,
+ ]);
}
}
diff --git a/tests/ocs-provider/provider.php b/tests/ocs-provider/provider.php
index 07d66b36258..17f557b16b5 100644
--- a/tests/ocs-provider/provider.php
+++ b/tests/ocs-provider/provider.php
@@ -57,12 +57,14 @@ class OcsProviderTest extends \Test\TestCase {
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
'version' => 2,
- 'PRIVATE_DATA' => [
- 'version' => 1,
- 'endpoints' => [
- 'store' => '/ocs/v2.php/privatedata/setattribute',
- 'read' => '/ocs/v2.php/privatedata/getattribute',
- 'delete' => '/ocs/v2.php/privatedata/deleteattribute',
+ 'services' => [
+ 'PRIVATE_DATA' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'store' => '/ocs/v2.php/privatedata/setattribute',
+ 'read' => '/ocs/v2.php/privatedata/getattribute',
+ 'delete' => '/ocs/v2.php/privatedata/deleteattribute',
+ ],
],
],
]
@@ -91,25 +93,27 @@ class OcsProviderTest extends \Test\TestCase {
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
'version' => 2,
- 'PRIVATE_DATA' => [
- 'version' => 1,
- 'endpoints' => [
- 'store' => '/ocs/v2.php/privatedata/setattribute',
- 'read' => '/ocs/v2.php/privatedata/getattribute',
- 'delete' => '/ocs/v2.php/privatedata/deleteattribute',
+ 'services' => [
+ 'PRIVATE_DATA' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'store' => '/ocs/v2.php/privatedata/setattribute',
+ 'read' => '/ocs/v2.php/privatedata/getattribute',
+ 'delete' => '/ocs/v2.php/privatedata/deleteattribute',
+ ],
],
- ],
- 'FEDERATED_SHARING' => [
- 'version' => 1,
- 'endpoints' => [
- 'share' => '/ocs/v2.php/cloud/shares',
- 'webdav' => '/public.php/webdav/',
+ 'FEDERATED_SHARING' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'share' => '/ocs/v2.php/cloud/shares',
+ 'webdav' => '/public.php/webdav/',
+ ],
],
- ],
- 'SHARING' => [
- 'version' => 1,
- 'endpoints' => [
- 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
+ 'SHARING' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
+ ],
],
],
]
@@ -127,39 +131,41 @@ class OcsProviderTest extends \Test\TestCase {
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
'version' => 2,
- 'PRIVATE_DATA' => [
- 'version' => 1,
- 'endpoints' => [
- 'store' => '/ocs/v2.php/privatedata/setattribute',
- 'read' => '/ocs/v2.php/privatedata/getattribute',
- 'delete' => '/ocs/v2.php/privatedata/deleteattribute',
+ 'services' => [
+ 'PRIVATE_DATA' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'store' => '/ocs/v2.php/privatedata/setattribute',
+ 'read' => '/ocs/v2.php/privatedata/getattribute',
+ 'delete' => '/ocs/v2.php/privatedata/deleteattribute',
+ ],
],
- ],
- 'FEDERATED_SHARING' => [
- 'version' => 1,
- 'endpoints' => [
- 'share' => '/ocs/v2.php/cloud/shares',
- 'webdav' => '/public.php/webdav/',
+ 'FEDERATED_SHARING' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'share' => '/ocs/v2.php/cloud/shares',
+ 'webdav' => '/public.php/webdav/',
+ ],
],
- ],
- 'SHARING' => [
- 'version' => 1,
- 'endpoints' => [
- 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
+ 'SHARING' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
+ ],
],
- ],
- 'ACTIVITY' => [
- 'version' => 1,
- 'endpoints' => [
- 'list' => '/ocs/v2.php/cloud/activity',
+ 'ACTIVITY' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'list' => '/ocs/v2.php/cloud/activity',
+ ],
],
- ],
- 'PROVISIONING' => [
- 'version' => 1,
- 'endpoints' => [
- 'user' => '/ocs/v2.php/cloud/users',
- 'groups' => '/ocs/v2.php/cloud/groups',
- 'apps' => '/ocs/v2.php/cloud/apps',
+ 'PROVISIONING' => [
+ 'version' => 1,
+ 'endpoints' => [
+ 'user' => '/ocs/v2.php/cloud/users',
+ 'groups' => '/ocs/v2.php/cloud/groups',
+ 'apps' => '/ocs/v2.php/cloud/apps',
+ ],
],
],
]