diff options
author | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-09 23:29:30 +0100 |
---|---|---|
committer | Jeremy Benoist <jeremy.benoist@gmail.com> | 2019-01-09 23:31:14 +0100 |
commit | 3a2d4cf9fda87760c86320a7f8a5041d1d4256c6 (patch) | |
tree | e21e28b440f9318cd3fbb91043e40e0d725bbc5c /tests/Wallabag | |
parent | 4d0c632c70ea50d459c3c55ddda2e0f394dd51cb (diff) | |
download | wallabag-3a2d4cf9fda87760c86320a7f8a5041d1d4256c6.tar.gz wallabag-3a2d4cf9fda87760c86320a7f8a5041d1d4256c6.tar.zst wallabag-3a2d4cf9fda87760c86320a7f8a5041d1d4256c6.zip |
Cast client id to avoid PG error
If someone send a malformated client_id when trying to authenticate using the API we got a 500 if wallabag use postgres because the request send a string instead of an integer.
Diffstat (limited to 'tests/Wallabag')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php index f58d1c12..e1a0ac7e 100644 --- a/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php | |||
@@ -56,6 +56,20 @@ class DeveloperControllerTest extends WallabagCoreTestCase | |||
56 | $this->assertArrayHasKey('refresh_token', $data); | 56 | $this->assertArrayHasKey('refresh_token', $data); |
57 | } | 57 | } |
58 | 58 | ||
59 | public function testCreateTokenWithBadClientId() | ||
60 | { | ||
61 | $client = $this->getClient(); | ||
62 | $client->request('POST', '/oauth/v2/token', [ | ||
63 | 'grant_type' => 'password', | ||
64 | 'client_id' => '$WALLABAG_CLIENT_ID', | ||
65 | 'client_secret' => 'secret', | ||
66 | 'username' => 'admin', | ||
67 | 'password' => 'mypassword', | ||
68 | ]); | ||
69 | |||
70 | $this->assertSame(400, $client->getResponse()->getStatusCode()); | ||
71 | } | ||
72 | |||
59 | public function testListingClient() | 73 | public function testListingClient() |
60 | { | 74 | { |
61 | $this->logInAs('admin'); | 75 | $this->logInAs('admin'); |