From 3107f92acb638bb5bf8067daaa5500ae65b5b116 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 16 Mar 2016 21:07:01 +0100 Subject: Don't add entry through API if it already exists --- .../Tests/Controller/WallabagRestControllerTest.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/Wallabag/ApiBundle/Tests/Controller') diff --git a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php index c264180c..2e78d8b2 100644 --- a/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/Controller/WallabagRestControllerTest.php @@ -166,6 +166,24 @@ class WallabagRestControllerTest extends WallabagApiTestCase $this->assertCount(1, $content['tags']); } + public function testPostSameEntry() + { + $this->client->request('POST', '/api/entries.json', array( + 'url' => 'http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', + 'archive' => '1', + )); + + $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); + + $content = json_decode($this->client->getResponse()->getContent(), true); + + $this->assertGreaterThan(0, $content['id']); + $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']); + $this->assertEquals(true, $content['is_archived']); + $this->assertEquals(false, $content['is_starred']); + $this->assertCount(1, $content['tags']); + } + public function testPostArchivedAndStarredEntry() { $this->client->request('POST', '/api/entries.json', array( -- cgit v1.2.3