aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ApiBundle
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-06-08 17:24:49 +0200
committerGitHub <noreply@github.com>2017-06-08 17:24:49 +0200
commit3f474025d889c3eff20b481f005f4d292f1ef29d (patch)
treee74288b7df91e226b1d23a4047a3af5cc04a6484 /tests/Wallabag/ApiBundle
parent2da8f071cfcc6e50be7be66c037de23f0d073bea (diff)
parenta8d3fe50df52ec486add5691a3b67fe5205a032e (diff)
downloadwallabag-3f474025d889c3eff20b481f005f4d292f1ef29d.tar.gz
wallabag-3f474025d889c3eff20b481f005f4d292f1ef29d.tar.zst
wallabag-3f474025d889c3eff20b481f005f4d292f1ef29d.zip
Merge pull request #3187 from wallabag/api-client-credentials
Create (and return) a client after creating a new user using the API
Diffstat (limited to 'tests/Wallabag/ApiBundle')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/UserRestControllerTest.php
index 5735bc58..4e65f130 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);
@@ -79,6 +85,7 @@ class UserRestControllerTest extends WallabagApiTestCase
79 'username' => 'google', 85 'username' => 'google',
80 'password' => 'googlegoogle', 86 'password' => 'googlegoogle',
81 'email' => 'wallabag@google.com', 87 'email' => 'wallabag@google.com',
88 'client_name' => 'My client name !!',
82 ]); 89 ]);
83 90
84 $this->assertEquals(201, $client->getResponse()->getStatusCode()); 91 $this->assertEquals(201, $client->getResponse()->getStatusCode());
@@ -90,10 +97,16 @@ class UserRestControllerTest extends WallabagApiTestCase
90 $this->assertArrayHasKey('username', $content); 97 $this->assertArrayHasKey('username', $content);
91 $this->assertArrayHasKey('created_at', $content); 98 $this->assertArrayHasKey('created_at', $content);
92 $this->assertArrayHasKey('updated_at', $content); 99 $this->assertArrayHasKey('updated_at', $content);
100 $this->assertArrayHasKey('default_client', $content);
93 101
94 $this->assertEquals('wallabag@google.com', $content['email']); 102 $this->assertEquals('wallabag@google.com', $content['email']);
95 $this->assertEquals('google', $content['username']); 103 $this->assertEquals('google', $content['username']);
96 104
105 $this->assertArrayHasKey('client_secret', $content['default_client']);
106 $this->assertArrayHasKey('client_id', $content['default_client']);
107
108 $this->assertEquals('My client name !!', $content['default_client']['name']);
109
97 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type')); 110 $this->assertEquals('application/json', $client->getResponse()->headers->get('Content-Type'));
98 111
99 $client->getContainer()->get('craue_config')->set('api_user_registration', 0); 112 $client->getContainer()->get('craue_config')->set('api_user_registration', 0);