1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-05 12:50:11 +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:
Adam Tauber 2015-05-02 13:34:53 -04:00
commit 01de1c6f78
2 changed files with 4 additions and 2 deletions

View File

@ -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

View File

@ -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)