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,7 +76,8 @@ def request(query, params):
|
||||
query=urlencode({'q': query}))
|
||||
|
||||
params['headers']['Accept-Language'] = language
|
||||
params['cookies']['PREF'] = get_google_pref_cookie()
|
||||
if language.startswith('en'):
|
||||
params['cookies']['PREF'] = get_google_pref_cookie()
|
||||
|
||||
return params
|
||||
|
||||
|
@ -17,12 +17,13 @@ class TestGoogleEngine(SearxTestCase):
|
||||
self.assertIn('url', params)
|
||||
self.assertIn(query, 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'])
|
||||
|
||||
dicto['language'] = 'all'
|
||||
params = google.request(query, dicto)
|
||||
self.assertIn('en', params['headers']['Accept-Language'])
|
||||
self.assertIn('PREF', params['cookies'])
|
||||
|
||||
def test_response(self):
|
||||
self.assertRaises(AttributeError, google.response, None)
|
||||
|
Loading…
Reference in New Issue
Block a user