aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2016-10-08 13:31:54 +0200
committerGitHub <noreply@github.com>2016-10-08 13:31:54 +0200
commit93a95c09bf7ab389de623f6cda01dfc295aa6b74 (patch)
treedfd6ab58fb234b2cc795eca7f3f5951cd4e2aea2 /tests
parent4ad6f5878a7e7ab6359151b049fb49b9dd2c78ec (diff)
parentee32248f43baef7e995c9e420cd00a137e626cf0 (diff)
downloadwallabag-93a95c09bf7ab389de623f6cda01dfc295aa6b74.tar.gz
wallabag-93a95c09bf7ab389de623f6cda01dfc295aa6b74.tar.zst
wallabag-93a95c09bf7ab389de623f6cda01dfc295aa6b74.zip
Merge pull request #2351 from wallabag/fix-api-client-deletion
Changed relation between API client and refresh token
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php (renamed from tests/Wallabag/CoreBundle/Controller/DeveloperControllerTest.php)28
1 files changed, 27 insertions, 1 deletions
diff --git a/tests/Wallabag/CoreBundle/Controller/DeveloperControllerTest.php b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
index 97ed0d58..95befa9c 100644
--- a/tests/Wallabag/CoreBundle/Controller/DeveloperControllerTest.php
+++ b/tests/Wallabag/ApiBundle/Controller/DeveloperControllerTest.php
@@ -1,6 +1,6 @@
1<?php 1<?php
2 2
3namespace Tests\Wallabag\CoreBundle\Controller; 3namespace Tests\Wallabag\ApiBundle\Controller;
4 4
5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase; 5use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
6 6
@@ -33,6 +33,32 @@ class DeveloperControllerTest extends WallabagCoreTestCase
33 $this->assertContains('My app', $alert[0]); 33 $this->assertContains('My app', $alert[0]);
34 } 34 }
35 35
36 /**
37 * @depends testCreateClient
38 */
39 public function testCreateToken()
40 {
41 $client = $this->getClient();
42 $em = $client->getContainer()->get('doctrine.orm.entity_manager');
43 $apiClient = $em->getRepository('WallabagApiBundle:Client')->findOneByName('My app');
44
45 $client->request('POST', '/oauth/v2/token', [
46 'grant_type' => 'password',
47 'client_id' => $apiClient->getPublicId(),
48 'client_secret' => $apiClient->getSecret(),
49 'username' => 'admin',
50 'password' => 'mypassword',
51 ]);
52
53 $this->assertEquals(200, $client->getResponse()->getStatusCode());
54
55 $data = json_decode($client->getResponse()->getContent(), true);
56 $this->assertArrayHasKey('access_token', $data);
57 $this->assertArrayHasKey('expires_in', $data);
58 $this->assertArrayHasKey('token_type', $data);
59 $this->assertArrayHasKey('refresh_token', $data);
60 }
61
36 public function testListingClient() 62 public function testListingClient()
37 { 63 {
38 $this->logInAs('admin'); 64 $this->logInAs('admin');