aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-06-07 23:23:28 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-06-07 23:23:28 +0200
commit0c00e5251671c3648eabb8888271c09137ad902d (patch)
tree2fe5de8701fa80ea9481e4098203b95d787ce576 /tests
parent7bb3aa31776ffce2735a3b16f6ad80bb17946d4d (diff)
downloadwallabag-0c00e5251671c3648eabb8888271c09137ad902d.tar.gz
wallabag-0c00e5251671c3648eabb8888271c09137ad902d.tar.zst
wallabag-0c00e5251671c3648eabb8888271c09137ad902d.zip
Create a client when creating a user using the api
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.
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php12
1 files changed, 12 insertions, 0 deletions
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
61 $this->assertArrayHasKey('username', $content); 61 $this->assertArrayHasKey('username', $content);
62 $this->assertArrayHasKey('created_at', $content); 62 $this->assertArrayHasKey('created_at', $content);
63 $this->assertArrayHasKey('updated_at', $content); 63 $this->assertArrayHasKey('updated_at', $content);
64 $this->assertArrayHasKey('default_client', $content);
64 65
65 $this->assertEquals('wallabag@google.com', $content['email']); 66 $this->assertEquals('wallabag@google.com', $content['email']);
66 $this->assertEquals('google', $content['username']); 67 $this->assertEquals('google', $content['username']);
67 68
69 $this->assertArrayHasKey('client_secret', $content['default_client']);
70 $this->assertArrayHasKey('client_id', $content['default_client']);
71
72 $this->assertEquals('Default client', $content['default_client']['name']);
73
68 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); 74 $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
69 75
70 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0); 76 $this->client->getContainer()->get('craue_config')->set('api_user_registration', 0);
@@ -90,10 +96,16 @@ class UserRestControllerTest extends WallabagApiTestCase
90 $this->assertArrayHasKey('username', $content); 96 $this->assertArrayHasKey('username', $content);
91 $this->assertArrayHasKey('created_at', $content); 97 $this->assertArrayHasKey('created_at', $content);
92 $this->assertArrayHasKey('updated_at', $content); 98 $this->assertArrayHasKey('updated_at', $content);
99 $this->assertArrayHasKey('default_client', $content);
93 100
94 $this->assertEquals('wallabag@google.com', $content['email']); 101 $this->assertEquals('wallabag@google.com', $content['email']);
95 $this->assertEquals('google', $content['username']); 102 $this->assertEquals('google', $content['username']);
96 103
104 $this->assertArrayHasKey('client_secret', $content['default_client']);
105 $this->assertArrayHasKey('client_id', $content['default_client']);
106
107 $this->assertEquals('Default client', $content['default_client']['name']);
108
97 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 109 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
98 110
99 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 111 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);