From 0c00e5251671c3648eabb8888271c09137ad902d Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 7 Jun 2017 23:23:28 +0200 Subject: Create a client when creating a user using the api MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit While creating a new user using the API, we also create a new client for the current user. So the app which just create the user can use its newly created client to configure the app. That new client is only return after creating the user. When calling the endpoint /api/user to get user information, the new client information won’t be return. --- .../Wallabag/ApiBundle/Controller/UserRestControllerTest.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/Wallabag/ApiBundle/Controller') diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php index 5735bc58..9f01a976 100644 --- a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php @@ -61,10 +61,16 @@ class UserRestControllerTest extends WallabagApiTestCase $this->assertArrayHasKey('username', $content); $this->assertArrayHasKey('created_at', $content); $this->assertArrayHasKey('updated_at', $content); + $this->assertArrayHasKey('default_client', $content); $this->assertEquals('wallabag@google.com', $content['email']); $this->assertEquals('google', $content['username']); + $this->assertArrayHasKey('client_secret', $content['default_client']); + $this->assertArrayHasKey('client_id', $content['default_client']); + + $this->assertEquals('Default client', $content['default_client']['name']); + $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0); @@ -90,10 +96,16 @@ class UserRestControllerTest extends WallabagApiTestCase $this->assertArrayHasKey('username', $content); $this->assertArrayHasKey('created_at', $content); $this->assertArrayHasKey('updated_at', $content); + $this->assertArrayHasKey('default_client', $content); $this->assertEquals('wallabag@google.com', $content['email']); $this->assertEquals('google', $content['username']); + $this->assertArrayHasKey('client_secret', $content['default_client']); + $this->assertArrayHasKey('client_id', $content['default_client']); + + $this->assertEquals('Default client', $content['default_client']['name']); + $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); $client->getContainer()->get('craue_config')->set('api_user_registration', 0); -- cgit v1.2.3