From 405e5c8f24d7e9eee45d830e229570f459e25847 Mon Sep 17 00:00:00 2001 From: marc Date: Tue, 4 Jul 2017 22:29:06 -0500 Subject: [fix] duckduckgo images doesn't fail with countryless language --- tests/unit/engines/test_duckduckgo_images.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'tests/unit/engines/test_duckduckgo_images.py') diff --git a/tests/unit/engines/test_duckduckgo_images.py b/tests/unit/engines/test_duckduckgo_images.py index 5f94e3c2b..a8a57c7fd 100644 --- a/tests/unit/engines/test_duckduckgo_images.py +++ b/tests/unit/engines/test_duckduckgo_images.py @@ -8,6 +8,8 @@ from searx.testing import SearxTestCase class TestDuckduckgoImagesEngine(SearxTestCase): def test_request(self): + duckduckgo_images.supported_languages = ['de-CH', 'en-US'] + query = 'test_query' dicto = defaultdict(dict) dicto['is_test'] = True @@ -22,14 +24,16 @@ class TestDuckduckgoImagesEngine(SearxTestCase): self.assertIn('p=-1', params['url']) self.assertIn('vqd=12345', params['url']) - # test paging and safe search + # test paging, safe search and language dicto['pageno'] = 2 dicto['safesearch'] = 2 + dicto['language'] = 'de' params = duckduckgo_images.request(query, dicto) self.assertIn('url', params) self.assertIn(query, params['url']) self.assertIn('s=50', params['url']) self.assertIn('p=1', params['url']) + self.assertIn('ch-de', params['url']) def test_response(self): self.assertRaises(AttributeError, duckduckgo_images.response, None) -- cgit v1.2.3-54-g00ecf