From 6273fefd5d945de1d871815a652f5a716e12e820 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Oct 2016 17:15:28 +0200 Subject: Add an exists endpoint in API It should allow third party to check if an url was already saved by a user --- .../ApiBundle/Controller/WallabagRestControllerTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/Wallabag/ApiBundle') diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index 101c20eb..e582e5f9 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -684,4 +684,15 @@ class WallabagRestControllerTest extends WallabagApiTestCase $this->assertEquals(true, $content['is_starred']); } + + public function testGetEntriesExists() + { + $this->client->request('GET', '/api/entries/exists?url=http://0.0.0.0/entry2'); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + $content = json_decode($this->client->getResponse()->getContent(), true); + + $this->assertEquals(true, $content['exists']); + } } -- cgit v1.2.3 From 55551e332c2fe3e502b32eba92b63a967afcc0ef Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 1 Oct 2016 17:26:36 +0200 Subject: =?UTF-8?q?Add=20test=20when=20url=20doesn=E2=80=99t=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiBundle/Controller/WallabagRestControllerTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/Wallabag/ApiBundle') diff --git a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php index e582e5f9..9b5760bc 100644 --- a/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/WallabagRestControllerTest.php @@ -695,4 +695,15 @@ class WallabagRestControllerTest extends WallabagApiTestCase $this->assertEquals(true, $content['exists']); } + + public function testGetEntriesExistsWhichDoesNotExists() + { + $this->client->request('GET', '/api/entries/exists?url=http://google.com/entry2'); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + $content = json_decode($this->client->getResponse()->getContent(), true); + + $this->assertEquals(false, $content['exists']); + } } -- cgit v1.2.3