From 0a1a3e7371df02580ad923fa0a4c1f4a7c08d759 Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Fri, 12 Jun 2015 19:54:03 +0200 Subject: Add a bit of testing to improve coverage --- searx/tests/engines/test_yahoo_news.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'searx/tests/engines/test_yahoo_news.py') 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 - +
  • +
    +

    + + +

    +
    +
    +
    +
  • + """ response = mock.Mock(text=html) results = yahoo_news.response(response) -- cgit v1.2.3