diff options
author | marc <a01200356@itesm.mx> | 2017-10-10 16:49:49 -0500 |
---|---|---|
committer | marc <a01200356@itesm.mx> | 2017-10-10 16:49:49 -0500 |
commit | a524dbb823e88482a762d56ac1ed352641f3f0c3 (patch) | |
tree | 21604320f131f5eddde172426685c7c5f4f8a98a /tests | |
parent | 1adc8d6e2604be1a159c936b0fd77efdd09c555e (diff) | |
download | searxng-a524dbb823e88482a762d56ac1ed352641f3f0c3.tar.gz searxng-a524dbb823e88482a762d56ac1ed352641f3f0c3.zip |
[fix] language support for bing images and videos
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/engines/test_bing_images.py | 12 | ||||
-rw-r--r-- | tests/unit/engines/test_bing_videos.py | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/tests/unit/engines/test_bing_images.py b/tests/unit/engines/test_bing_images.py index 287f13499..8b0bdb39d 100644 --- a/tests/unit/engines/test_bing_images.py +++ b/tests/unit/engines/test_bing_images.py @@ -8,10 +8,12 @@ from searx.testing import SearxTestCase class TestBingImagesEngine(SearxTestCase): def test_request(self): + bing_images.supported_languages = ['fr-FR', 'en-US'] + query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 1 - dicto['language'] = 'fr_FR' + dicto['language'] = 'fr-FR' dicto['safesearch'] = 1 dicto['time_range'] = '' params = bing_images.request(query, dicto) @@ -19,12 +21,14 @@ class TestBingImagesEngine(SearxTestCase): self.assertTrue(query in params['url']) self.assertTrue('bing.com' in params['url']) self.assertTrue('SRCHHPGUSR' in params['cookies']) - self.assertTrue('fr' in params['cookies']['SRCHHPGUSR']) + self.assertTrue('DEMOTE' in params['cookies']['SRCHHPGUSR']) + self.assertTrue('_EDGE_S' in params['cookies']) + self.assertTrue('fr-fr' in params['cookies']['_EDGE_S']) dicto['language'] = 'all' params = bing_images.request(query, dicto) - self.assertIn('SRCHHPGUSR', params['cookies']) - self.assertIn('en', params['cookies']['SRCHHPGUSR']) + self.assertTrue('_EDGE_S' in params['cookies']) + self.assertTrue('en' in params['cookies']['_EDGE_S']) def test_response(self): self.assertRaises(AttributeError, bing_images.response, None) diff --git a/tests/unit/engines/test_bing_videos.py b/tests/unit/engines/test_bing_videos.py index 011b5410a..118754b25 100644 --- a/tests/unit/engines/test_bing_videos.py +++ b/tests/unit/engines/test_bing_videos.py @@ -8,6 +8,8 @@ from searx.testing import SearxTestCase class TestBingVideosEngine(SearxTestCase): def test_request(self): + bing_videos.supported_languages = ['fr-FR', 'en-US'] + query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 1 |