From 204a2cbbf0618d1d8b7d4c52878e43afe4e92444 Mon Sep 17 00:00:00 2001 From: Frank de Lange Date: Sat, 27 Jul 2019 17:49:30 +0200 Subject: [fix] bing_videos (#1579) use JSON where possible, compose 'content' using all available data, use correct 'url' (direct to source instead of redirect through bing) --- tests/unit/engines/test_bing_videos.py | 54 ++++++++-------------------------- 1 file changed, 13 insertions(+), 41 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/engines/test_bing_videos.py b/tests/unit/engines/test_bing_videos.py index 1ae1fad37..5e171eb53 100644 --- a/tests/unit/engines/test_bing_videos.py +++ b/tests/unit/engines/test_bing_videos.py @@ -29,7 +29,7 @@ class TestBingVideosEngine(SearxTestCase): dicto['time_range'] = 'day' dicto['safesearch'] = 2 params = bing_videos.request(query, dicto) - self.assertTrue('first=11' in params['url']) + self.assertTrue('first=29' in params['url']) self.assertTrue('1440' in params['url']) self.assertIn('SRCHHPGUSR', params['cookies']) self.assertTrue('STRICT' in params['cookies']['SRCHHPGUSR']) @@ -48,53 +48,25 @@ class TestBingVideosEngine(SearxTestCase): html = """
-
- -
-
- -
-
""" response = mock.Mock(text=html) results = bing_videos.response(response) self.assertEqual(type(results), list) self.assertEqual(len(results), 1) self.assertEqual(results[0]['title'], 'Title 1') - self.assertEqual(results[0]['url'], 'https://bing.com/video') - self.assertEqual(results[0]['content'], 'Content 1') - self.assertEqual(results[0]['thumbnail'], 'thumb_1.jpg') + self.assertEqual(results[0]['url'], 'https://www.example.com/watch?v=DEADBEEF') + self.assertEqual(results[0]['content'], '01:11 - 100 views - 1 year ago - ExampleTube - Channel 1') + self.assertEqual(results[0]['thumbnail'], 'https://www.bing.com/th?id=OVP.BINGTHUMB1') -- cgit v1.2.3