From 9ee8e552da4654cd41228ce1a3addfa1fa1f377d Mon Sep 17 00:00:00 2001 From: marc Date: Sat, 13 May 2017 02:22:27 -0500 Subject: [fix] bing images --- tests/unit/engines/test_bing_images.py | 113 +++++++++++---------------------- 1 file changed, 37 insertions(+), 76 deletions(-) (limited to 'tests') diff --git a/tests/unit/engines/test_bing_images.py b/tests/unit/engines/test_bing_images.py index cc256f51e..287f13499 100644 --- a/tests/unit/engines/test_bing_images.py +++ b/tests/unit/engines/test_bing_images.py @@ -39,85 +39,46 @@ class TestBingImagesEngine(SearxTestCase): self.assertEqual(bing_images.response(response), []) html = """ -
- - - - -
- """ # noqa - html = html.replace('\r\n', '').replace('\n', '').replace('\r', '') - response = mock.Mock(text=html) - results = bing_images.response(response) - self.assertEqual(type(results), list) - self.assertEqual(len(results), 1) - self.assertEqual(results[0]['title'], 'South Carolina') - self.assertEqual(results[0]['url'], - 'http://www.digital-topo-maps.com/county-map/south-carolina.shtml') - self.assertEqual(results[0]['content'], '') - self.assertEqual(results[0]['thumbnail_src'], - 'https://www.bing.com/th?id=OIP.Mbf3bc87efe6e0e476be8cc34bf6cd80eH0') - self.assertEqual(results[0]['img_src'], - 'http://www.digital-topo-maps.com/county-map/south-carolina-county-map.gif') - - html = """ - - - - """ - response = mock.Mock(text=html) - results = bing_images.response(response) - self.assertEqual(type(results), list) - self.assertEqual(len(results), 0) - - html = """ -
- - - -
-
- - - -
-
- - - -
+
+ + +
""" html = html.replace('\r\n', '').replace('\n', '').replace('\r', '') response = mock.Mock(text=html) results = bing_images.response(response) self.assertEqual(type(results), list) self.assertEqual(len(results), 3) + self.assertEqual(results[0]['title'], 'alt text') + self.assertEqual(results[0]['url'], 'page_url') + self.assertEqual(results[0]['content'], '') + self.assertEqual(results[0]['thumbnail_src'], 'thumb_url') + self.assertEqual(results[0]['img_src'], 'img_url') -- cgit v1.2.3