forked from Icycoide/searxng
[fix] prevent google engine to redirect
nid/pref cookies are also removed
This commit is contained in:
parent
029291eca1
commit
5cea4f9445
2 changed files with 2 additions and 34 deletions
|
@ -9,7 +9,7 @@ from searx.testing import SearxTestCase
|
|||
class TestGoogleEngine(SearxTestCase):
|
||||
|
||||
def mock_response(self, text):
|
||||
response = mock.Mock(text=text, url='https://www.google.com/search?q=test&start=0&gbv=1')
|
||||
response = mock.Mock(text=text, url='https://www.google.com/search?q=test&start=0&gbv=1&gws_rd=cr')
|
||||
response.search_params = mock.Mock()
|
||||
response.search_params.get = mock.Mock(return_value='www.google.com')
|
||||
return response
|
||||
|
@ -23,16 +23,12 @@ class TestGoogleEngine(SearxTestCase):
|
|||
self.assertIn('url', params)
|
||||
self.assertIn(query, params['url'])
|
||||
self.assertIn('google.fr', params['url'])
|
||||
self.assertNotIn('PREF', params['cookies'])
|
||||
self.assertIn('NID', params['cookies'])
|
||||
self.assertIn('fr', params['headers']['Accept-Language'])
|
||||
|
||||
dicto['language'] = 'all'
|
||||
params = google.request(query, dicto)
|
||||
self.assertIn('google.com', params['url'])
|
||||
self.assertIn('en', params['headers']['Accept-Language'])
|
||||
# self.assertIn('PREF', params['cookies'])
|
||||
self.assertIn('NID', params['cookies'])
|
||||
|
||||
def test_response(self):
|
||||
self.assertRaises(AttributeError, google.response, None)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue