summaryrefslogtreecommitdiff
path: root/searx/tests/engines/test_yahoo_news.py
diff options
context:
space:
mode:
authorCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-06-12 19:54:03 +0200
committerCqoicebordel <Cqoicebordel@users.noreply.github.com>2015-06-12 19:54:03 +0200
commit0a1a3e7371df02580ad923fa0a4c1f4a7c08d759 (patch)
tree7a948cfd12022fa3a72eb071790c7a87105f454d /searx/tests/engines/test_yahoo_news.py
parentab273e2faaa0ad157443ffe0b09194fad17ad743 (diff)
Add a bit of testing to improve coverage
Diffstat (limited to 'searx/tests/engines/test_yahoo_news.py')
-rw-r--r--searx/tests/engines/test_yahoo_news.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/searx/tests/engines/test_yahoo_news.py b/searx/tests/engines/test_yahoo_news.py
index 94d819d61..4d7fc0a10 100644
--- a/searx/tests/engines/test_yahoo_news.py
+++ b/searx/tests/engines/test_yahoo_news.py
@@ -29,6 +29,13 @@ class TestYahooNewsEngine(SearxTestCase):
self.assertIn('en', params['cookies']['sB'])
self.assertIn('en', params['url'])
+ def test_sanitize_url(self):
+ url = "test.url"
+ self.assertEqual(url, yahoo_news.sanitize_url(url))
+
+ url = "www.yahoo.com/;_ylt=test"
+ self.assertEqual("www.yahoo.com/", yahoo_news.sanitize_url(url))
+
def test_response(self):
self.assertRaises(AttributeError, yahoo_news.response, None)
self.assertRaises(AttributeError, yahoo_news.response, [])
@@ -57,7 +64,17 @@ class TestYahooNewsEngine(SearxTestCase):
This is the content
</div>
</li>
- </div>
+ <li class="first">
+ <div class="compTitle">
+ <h3>
+ <a class="yschttl spt" target="_blank">
+ </a>
+ </h3>
+ </div>
+ <div class="compText">
+ </div>
+ </li>
+ </ol>
"""
response = mock.Mock(text=html)
results = yahoo_news.response(response)