From 44ed4424f60533b73f452252f95f1bc00ec48bc8 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Sat, 2 May 2015 21:08:56 +0200 Subject: [fix] yahoo_news engine --- searx/tests/engines/test_yahoo_news.py | 153 +++++++++++++++------------------ 1 file changed, 71 insertions(+), 82 deletions(-) (limited to 'searx/tests') diff --git a/searx/tests/engines/test_yahoo_news.py b/searx/tests/engines/test_yahoo_news.py index 797dc11b7..94d819d61 100644 --- a/searx/tests/engines/test_yahoo_news.py +++ b/searx/tests/engines/test_yahoo_news.py @@ -39,19 +39,24 @@ class TestYahooNewsEngine(SearxTestCase): self.assertEqual(yahoo_news.response(response), []) html = """ -
-
-

- - This is - the title... - -

-
- Business via Yahoo! Finance   Feb 03 09:45am -
- This is the content -
+
    +
  1. + +
    + Business via Yahoo! + May 01 10:00 AM +
    +
    + This is the content +
    +
""" response = mock.Mock(text=html) @@ -63,48 +68,59 @@ class TestYahooNewsEngine(SearxTestCase): self.assertEqual(results[0]['content'], 'This is the content') html = """ -
-
-

- - This is - the title... - -

-
- Business via Yahoo!   2 hours, 22 minutes ago -
- This is the content -
-
-
-
-

- - This is - the title... - -

-
- Business via Yahoo!   22 minutes ago -
- This is the content -
-
-
-
-

- - This is - the title... - -

-
- Business via Yahoo!   Feb 03 09:45am 1900 -
- This is the content -
-
+
    +
  1. + +
    + Business via Yahoo! + 2 hours, 22 minutes ago +
    +
    + This is the content +
    +
  2. +
  3. + +
    + Business via Yahoo! + 22 minutes ago +
    +
    + This is the content +
    +
  4. +
  5. + +
    + Business via Yahoo! + Feb 03 09:45AM 1900 +
    +
    + This is the content +
    +
  6. +
""" response = mock.Mock(text=html) results = yahoo_news.response(response) @@ -114,30 +130,3 @@ class TestYahooNewsEngine(SearxTestCase): self.assertEqual(results[0]['url'], 'http://this.is.the.url/') self.assertEqual(results[0]['content'], 'This is the content') self.assertEqual(results[2]['publishedDate'].year, datetime.now().year) - - html = """ -
  • -
    - -
    - - this.meta.com - - - - -
    -

    - This should be the content.

    -
    -
  • - """ - response = mock.Mock(text=html) - results = yahoo_news.response(response) - self.assertEqual(type(results), list) - self.assertEqual(len(results), 0) -- cgit v1.2.3