mirror of
https://github.com/searxng/searxng.git
synced 2024-11-05 21:00:13 +01:00
Merge pull request #303 from dalf/patch-1
Revert of #195 when the search language is not english
This commit is contained in:
commit
01de1c6f78
@ -76,6 +76,7 @@ def request(query, params):
|
|||||||
query=urlencode({'q': query}))
|
query=urlencode({'q': query}))
|
||||||
|
|
||||||
params['headers']['Accept-Language'] = language
|
params['headers']['Accept-Language'] = language
|
||||||
|
if language.startswith('en'):
|
||||||
params['cookies']['PREF'] = get_google_pref_cookie()
|
params['cookies']['PREF'] = get_google_pref_cookie()
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
@ -17,12 +17,13 @@ class TestGoogleEngine(SearxTestCase):
|
|||||||
self.assertIn('url', params)
|
self.assertIn('url', params)
|
||||||
self.assertIn(query, params['url'])
|
self.assertIn(query, params['url'])
|
||||||
self.assertIn('google.com', params['url'])
|
self.assertIn('google.com', params['url'])
|
||||||
self.assertIn('PREF', params['cookies'])
|
self.assertNotIn('PREF', params['cookies'])
|
||||||
self.assertIn('fr', params['headers']['Accept-Language'])
|
self.assertIn('fr', params['headers']['Accept-Language'])
|
||||||
|
|
||||||
dicto['language'] = 'all'
|
dicto['language'] = 'all'
|
||||||
params = google.request(query, dicto)
|
params = google.request(query, dicto)
|
||||||
self.assertIn('en', params['headers']['Accept-Language'])
|
self.assertIn('en', params['headers']['Accept-Language'])
|
||||||
|
self.assertIn('PREF', params['cookies'])
|
||||||
|
|
||||||
def test_response(self):
|
def test_response(self):
|
||||||
self.assertRaises(AttributeError, google.response, None)
|
self.assertRaises(AttributeError, google.response, None)
|
||||||
|
Loading…
Reference in New Issue
Block a user