# -*- coding: utf-8 -*- from collections import defaultdict import mock from searx.engines import startpage from searx.testing import SearxTestCase class TestStartpageEngine(SearxTestCase): def test_request(self): query = 'test_query' dicto = defaultdict(dict) dicto['pageno'] = 1 dicto['language'] = 'fr_FR' params = startpage.request(query, dicto) self.assertIn('url', params) self.assertIn('startpage.com', params['url']) self.assertIn('data', params) self.assertIn('query', params['data']) self.assertIn(query, params['data']['query']) self.assertIn('with_language', params['data']) self.assertIn('lang_fr', params['data']['with_language']) def test_response(self): self.assertRaises(AttributeError, startpage.response, None) self.assertRaises(AttributeError, startpage.response, []) self.assertRaises(AttributeError, startpage.response, '') self.assertRaises(AttributeError, startpage.response, '[]') response = mock.Mock(text='') self.assertEqual(startpage.response(response), []) html = """
This should be the content.
www.speedtest.net/fr/ - Navigation avec Ixquick Proxy - Mis en surbrillance
This should be the content.
www.speedtest.net/fr/ - Navigation avec Ixquick Proxy - Mis en surbrillance
This should be the content.
www.speedtest.net/fr/
www.speedtest.net/fr/ - Navigation avec Ixquick Proxy - Mis en surbrillance