From 7019c7cf6c6af39c0f458769e20c3f9306477943 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 31 Dec 2015 11:24:46 +0100 Subject: Add tagged services for import - list services in /import - add url to import service - ImportBundle routing are now prefixed by /import - optimize flush in each import (flushing each 20 contents) - improve design of each import - add more tests --- .../Tests/Controller/PocketControllerTest.php | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php (limited to 'src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php') diff --git a/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php new file mode 100644 index 00000000..c2acd68c --- /dev/null +++ b/src/Wallabag/ImportBundle/Tests/Controller/PocketControllerTest.php @@ -0,0 +1,42 @@ +logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/import/pocket'); + + $this->assertEquals(200, $client->getResponse()->getStatusCode()); + $this->assertEquals(1, $crawler->filter('button[type=submit]')->count()); + } + + public function testImportPocketAuth() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/import/pocket/auth'); + + $this->assertEquals(301, $client->getResponse()->getStatusCode()); + $this->assertContains('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location')); + } + + public function testImportPocketCallbackWithBadToken() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/import/pocket/callback'); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + $this->assertContains('import/pocket', $client->getResponse()->headers->get('location')); + $this->assertEquals('Import failed, please try again.', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]); + } +} -- cgit v1.2.3