Fix formatting of response

The elements are expected to be within a `service` array as per specification.
This commit is contained in:
Lukas Reschke 2016-02-25 19:05:05 +01:00
parent 3772a8acdb
commit 0e19c6a3a0
2 changed files with 62 additions and 54 deletions

View File

@ -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,
]);
}
}

View File

@ -57,6 +57,7 @@ class OcsProviderTest extends \Test\TestCase {
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
'version' => 2,
'services' => [
'PRIVATE_DATA' => [
'version' => 1,
'endpoints' => [
@ -65,6 +66,7 @@ class OcsProviderTest extends \Test\TestCase {
'delete' => '/ocs/v2.php/privatedata/deleteattribute',
],
],
],
]
);
@ -91,6 +93,7 @@ class OcsProviderTest extends \Test\TestCase {
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
'version' => 2,
'services' => [
'PRIVATE_DATA' => [
'version' => 1,
'endpoints' => [
@ -112,6 +115,7 @@ class OcsProviderTest extends \Test\TestCase {
'share' => '/ocs/v2.php/apps/files_sharing/api/v1/shares',
],
],
],
]
);
@ -127,6 +131,7 @@ class OcsProviderTest extends \Test\TestCase {
$expected = new \OCP\AppFramework\Http\JSONResponse(
[
'version' => 2,
'services' => [
'PRIVATE_DATA' => [
'version' => 1,
'endpoints' => [
@ -162,6 +167,7 @@ class OcsProviderTest extends \Test\TestCase {
'apps' => '/ocs/v2.php/cloud/apps',
],
],
],
]
);