|
@@ -8,6 +8,8 @@ from searx.testing import SearxTestCase
|
8
|
8
|
class TestDuckduckgoImagesEngine(SearxTestCase):
|
9
|
9
|
|
10
|
10
|
def test_request(self):
|
|
11
|
+ duckduckgo_images.supported_languages = ['de-CH', 'en-US']
|
|
12
|
+
|
11
|
13
|
query = 'test_query'
|
12
|
14
|
dicto = defaultdict(dict)
|
13
|
15
|
dicto['is_test'] = True
|
|
@@ -22,14 +24,16 @@ class TestDuckduckgoImagesEngine(SearxTestCase):
|
22
|
24
|
self.assertIn('p=-1', params['url'])
|
23
|
25
|
self.assertIn('vqd=12345', params['url'])
|
24
|
26
|
|
25
|
|
- # test paging and safe search
|
|
27
|
+ # test paging, safe search and language
|
26
|
28
|
dicto['pageno'] = 2
|
27
|
29
|
dicto['safesearch'] = 2
|
|
30
|
+ dicto['language'] = 'de'
|
28
|
31
|
params = duckduckgo_images.request(query, dicto)
|
29
|
32
|
self.assertIn('url', params)
|
30
|
33
|
self.assertIn(query, params['url'])
|
31
|
34
|
self.assertIn('s=50', params['url'])
|
32
|
35
|
self.assertIn('p=1', params['url'])
|
|
36
|
+ self.assertIn('ch-de', params['url'])
|
33
|
37
|
|
34
|
38
|
def test_response(self):
|
35
|
39
|
self.assertRaises(AttributeError, duckduckgo_images.response, None)
|