Better cleanup of generic articles and lefigaro

try_drop_tree() was only removing the first result.
closes #725
This commit is contained in:
Laurent Bachelier 2012-02-01 01:10:26 +01:00
commit 57ce35cef1
3 changed files with 47 additions and 6 deletions

View file

@ -19,6 +19,7 @@
from weboob.tools.test import BackendTest
from weboob.tools.misc import html2text
__all__ = ['LeFigaroTest']
@ -30,3 +31,19 @@ class LeFigaroTest(BackendTest):
def test_new_messages(self):
for message in self.backend.iter_unread_messages():
pass
def test_content(self):
urls = ['http://www.lefigaro.fr/international/2011/10/24/01003-20111024ARTFIG00704-les-islamo-conservateurs-maitres-du-jeu-tunisien.php',
'http://www.lefigaro.fr/international/2012/01/29/01003-20120129ARTFIG00191-floride-la-primaire-suspendue-a-l-humeur-des-hispaniques.php']
for url in urls:
thread = self.backend.get_thread(url)
assert len(thread.root.content)
assert '<script' not in thread.root.content
assert 'object' not in thread.root.content
assert 'BFM' not in thread.root.content
assert 'AUSSI' not in thread.root.content
# no funny tags means html2text does not crash
assert len(html2text(thread.root.content))