diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-04-24 11:12:41 +0200 |
---|---|---|
committer | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2017-04-24 11:12:41 +0200 |
commit | d1fc590211b8dc7360bf5b7ee01c67ccff0577ea (patch) | |
tree | ec5466ed672b5930d68867201568f8e4ad5e1250 /tests | |
parent | b8acf672c0b7563d56841172d42429d1c57f0004 (diff) | |
download | wallabag-d1fc590211b8dc7360bf5b7ee01c67ccff0577ea.tar.gz wallabag-d1fc590211b8dc7360bf5b7ee01c67ccff0577ea.tar.zst wallabag-d1fc590211b8dc7360bf5b7ee01c67ccff0577ea.zip |
Added API endpoint to handle a list of URL and to add/delete tags
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php index dc5160c7..1f5c7a4f 100644 --- a/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php +++ b/tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php | |||
@@ -714,4 +714,35 @@ class EntryRestControllerTest extends WallabagApiTestCase | |||
714 | 714 | ||
715 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); | 715 | $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type')); |
716 | } | 716 | } |
717 | |||
718 | public function testPostEntriesTagsListAction() | ||
719 | { | ||
720 | $list = [ | ||
721 | [ | ||
722 | 'url' => 'http://0.0.0.0/entry1', | ||
723 | 'tags' => 'foo bar, baz', | ||
724 | 'action' => 'delete', | ||
725 | ], | ||
726 | [ | ||
727 | 'url' => 'http://0.0.0.0/entry2', | ||
728 | 'tags' => 'new tag 1, new tag 2', | ||
729 | 'action' => 'add', | ||
730 | ], | ||
731 | ]; | ||
732 | |||
733 | $this->client->request('POST', '/api/entries/tags/lists?list='.json_encode($list)); | ||
734 | |||
735 | $this->assertEquals(200, $this->client->getResponse()->getStatusCode()); | ||
736 | |||
737 | $content = json_decode($this->client->getResponse()->getContent(), true); | ||
738 | |||
739 | |||
740 | $this->assertFalse($content[0]['entry']); | ||
741 | $this->assertEquals('http://0.0.0.0/entry1', $content[0]['url']); | ||
742 | $this->assertEquals('delete', $content[0]['action']); | ||
743 | |||
744 | $this->assertInternalType('int', $content[1]['entry']); | ||
745 | $this->assertEquals('http://0.0.0.0/entry2', $content[1]['url']); | ||
746 | $this->assertEquals('add', $content[1]['action']); | ||
747 | } | ||
717 | } | 748 | } |