From 56ad00bc3292c345dfaa5a671844e222b5f72e5b Mon Sep 17 00:00:00 2001 From: Cqoicebordel Date: Fri, 20 Feb 2015 19:03:09 +0100 Subject: [PATCH] Correct a few UT --- searx/tests/engines/test_blekko_images.py | 11 ++++++++--- searx/tests/engines/test_google_images.py | 11 ++++++++--- searx/tests/engines/test_yahoo.py | 14 ++------------ 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/searx/tests/engines/test_blekko_images.py b/searx/tests/engines/test_blekko_images.py index 793fadbad..beb0853e3 100644 --- a/searx/tests/engines/test_blekko_images.py +++ b/searx/tests/engines/test_blekko_images.py @@ -12,9 +12,14 @@ class TestBlekkoImagesEngine(SearxTestCase): dicto['pageno'] = 0 dicto['safesearch'] = 1 params = blekko_images.request(query, dicto) - self.assertTrue('url' in params) - self.assertTrue(query in params['url']) - self.assertTrue('blekko.com' in params['url']) + self.assertIn('url', params) + self.assertIn(query, params['url']) + self.assertIn('blekko.com', params['url']) + self.assertIn('page', params['url']) + + dicto['pageno'] = 1 + params = blekko_images.request(query, dicto) + self.assertNotIn('page', params['url']) def test_response(self): self.assertRaises(AttributeError, blekko_images.response, None) diff --git a/searx/tests/engines/test_google_images.py b/searx/tests/engines/test_google_images.py index 6870ff52f..32d133334 100644 --- a/searx/tests/engines/test_google_images.py +++ b/searx/tests/engines/test_google_images.py @@ -11,9 +11,14 @@ class TestGoogleImagesEngine(SearxTestCase): dicto = defaultdict(dict) dicto['pageno'] = 1 params = google_images.request(query, dicto) - self.assertTrue('url' in params) - self.assertTrue(query in params['url']) - self.assertTrue('googleapis.com' in params['url']) + self.assertIn('url', params) + self.assertIn(query, params['url']) + self.assertIn('googleapis.com', params['url']) + self.assertIn('safe=on', params['url']) + + dicto['safesearch'] = 0 + params = google_images.request(query, dicto) + self.assertIn('safe=off', params['url']) def test_response(self): self.assertRaises(AttributeError, google_images.response, None) diff --git a/searx/tests/engines/test_yahoo.py b/searx/tests/engines/test_yahoo.py index cdd6fda29..11ef9db22 100644 --- a/searx/tests/engines/test_yahoo.py +++ b/searx/tests/engines/test_yahoo.py @@ -75,12 +75,6 @@ class TestYahooEngine(SearxTestCase):
  • This is the second content

    @@ -102,16 +96,12 @@ class TestYahooEngine(SearxTestCase): """ response = mock.Mock(text=html) results = yahoo.response(response) - print results self.assertEqual(type(results), list) - self.assertEqual(len(results), 3) + self.assertEqual(len(results), 2) self.assertEqual(results[0]['title'], 'This is the title') self.assertEqual(results[0]['url'], 'https://this.is.the.url/') self.assertEqual(results[0]['content'], 'This is the content') - self.assertEqual(results[1]['title'], 'This is the second title') - self.assertEqual(results[1]['url'], 'https://this.is.the.second.url/') - self.assertEqual(results[1]['content'], 'This is the second content') - self.assertEqual(results[2]['suggestion'], 'This is the suggestion') + self.assertEqual(results[1]['suggestion'], 'This is the suggestion') html = """