aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Wallabag/ImportBundle/Import
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2017-05-11 08:14:29 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2017-05-31 13:59:45 +0200
commite668a8124c46d47add4248963d77f3b29b37b3ce (patch)
treeb9b56d19b06fe268d025c3591119470162efc99a /tests/Wallabag/ImportBundle/Import
parent4423b88c5b2c2d530b0a83a822f521a61ca4d4b8 (diff)
downloadwallabag-e668a8124c46d47add4248963d77f3b29b37b3ce.tar.gz
wallabag-e668a8124c46d47add4248963d77f3b29b37b3ce.tar.zst
wallabag-e668a8124c46d47add4248963d77f3b29b37b3ce.zip
Allow other fields to be send using API
Entry API can now have these new fields: - content - language - preview_picture - published_at Re-use the ContentProxy to be able to do the same using the web UI (in the future). htmLawed is used to clean stuff from content, I hope it’ll be enough to avoid security breach. Lower content validation when we want to update an entry with content already defined. Before, language & content_type were required. If there weren’t provided, we re-fetched the content using graby. I think these fields aren’t required for an entry to be created. So I removed them. Which means some import from the v1 export won’t be re-fetched since they provide content, url & title. Also, remove liberation link from Readability import to avoid overlaping import (from wallabag v1, which had the same link)
Diffstat (limited to 'tests/Wallabag/ImportBundle/Import')
-rw-r--r--tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
index 254f0a25..25eedd1b 100644
--- a/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
+++ b/tests/Wallabag/ImportBundle/Import/ReadabilityImportTest.php
@@ -67,14 +67,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
67 67
68 public function testImport() 68 public function testImport()
69 { 69 {
70 $readabilityImport = $this->getReadabilityImport(false, 24); 70 $readabilityImport = $this->getReadabilityImport(false, 23);
71 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json'); 71 $readabilityImport->setFilepath(__DIR__.'/../fixtures/readability.json');
72 72
73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository') 73 $entryRepo = $this->getMockBuilder('Wallabag\CoreBundle\Repository\EntryRepository')
74 ->disableOriginalConstructor() 74 ->disableOriginalConstructor()
75 ->getMock(); 75 ->getMock();
76 76
77 $entryRepo->expects($this->exactly(24)) 77 $entryRepo->expects($this->exactly(23))
78 ->method('findByUrlAndUserId') 78 ->method('findByUrlAndUserId')
79 ->willReturn(false); 79 ->willReturn(false);
80 80
@@ -88,14 +88,14 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
88 ->getMock(); 88 ->getMock();
89 89
90 $this->contentProxy 90 $this->contentProxy
91 ->expects($this->exactly(24)) 91 ->expects($this->exactly(23))
92 ->method('updateEntry') 92 ->method('updateEntry')
93 ->willReturn($entry); 93 ->willReturn($entry);
94 94
95 $res = $readabilityImport->import(); 95 $res = $readabilityImport->import();
96 96
97 $this->assertTrue($res); 97 $this->assertTrue($res);
98 $this->assertEquals(['skipped' => 0, 'imported' => 24, 'queued' => 0], $readabilityImport->getSummary()); 98 $this->assertEquals(['skipped' => 0, 'imported' => 23, 'queued' => 0], $readabilityImport->getSummary());
99 } 99 }
100 100
101 public function testImportAndMarkAllAsRead() 101 public function testImportAndMarkAllAsRead()
@@ -165,7 +165,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
165 ->getMock(); 165 ->getMock();
166 166
167 $producer 167 $producer
168 ->expects($this->exactly(24)) 168 ->expects($this->exactly(23))
169 ->method('publish'); 169 ->method('publish');
170 170
171 $readabilityImport->setProducer($producer); 171 $readabilityImport->setProducer($producer);
@@ -173,7 +173,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
173 $res = $readabilityImport->setMarkAsRead(true)->import(); 173 $res = $readabilityImport->setMarkAsRead(true)->import();
174 174
175 $this->assertTrue($res); 175 $this->assertTrue($res);
176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $readabilityImport->getSummary()); 176 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 23], $readabilityImport->getSummary());
177 } 177 }
178 178
179 public function testImportWithRedis() 179 public function testImportWithRedis()
@@ -211,7 +211,7 @@ class ReadabilityImportTest extends \PHPUnit_Framework_TestCase
211 $res = $readabilityImport->setMarkAsRead(true)->import(); 211 $res = $readabilityImport->setMarkAsRead(true)->import();
212 212
213 $this->assertTrue($res); 213 $this->assertTrue($res);
214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 24], $readabilityImport->getSummary()); 214 $this->assertEquals(['skipped' => 0, 'imported' => 0, 'queued' => 23], $readabilityImport->getSummary());
215 215
216 $this->assertNotEmpty($redisMock->lpop('readability')); 216 $this->assertNotEmpty($redisMock->lpop('readability'));
217 } 217 }