logo

searx

My custom branche(s) on searx, a meta-search engine git clone https://hacktivis.me/git/searx.git
commit: 5954a8e16a64a369072a7487f62b6396a451ae5f
parent d20bba6dc74ded16556acf2a404d01ec47455ca6
Author: Noémi Ványi <sitbackandwait@gmail.com>
Date:   Wed,  1 Nov 2017 16:50:27 +0100

minor fix of BASE engine

Diffstat:

Msearx/engines/base.py2+-
Mtests/unit/engines/test_base.py6+++---
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/searx/engines/base.py b/searx/engines/base.py @@ -73,7 +73,7 @@ def request(query, params): def response(resp): results = [] - search_results = etree.XML(resp.text) + search_results = etree.XML(resp.content) for entry in search_results.xpath('./result/doc'): content = "No description available" diff --git a/tests/unit/engines/test_base.py b/tests/unit/engines/test_base.py @@ -21,10 +21,10 @@ class TestBaseEngine(SearxTestCase): self.assertRaises(AttributeError, base.response, '') self.assertRaises(AttributeError, base.response, '[]') - response = mock.Mock(text='<response></response>') + response = mock.Mock(content=b'<response></response>') self.assertEqual(base.response(response), []) - xml_mock = """<?xml version="1.0"?> + xml_mock = b"""<?xml version="1.0"?> <response> <lst name="responseHeader"> <int name="status">0</int> @@ -83,7 +83,7 @@ class TestBaseEngine(SearxTestCase): </result> </response>""" - response = mock.Mock(text=xml_mock.encode('utf-8')) + response = mock.Mock(content=xml_mock) results = base.response(response) self.assertEqual(type(results), list) self.assertEqual(len(results), 1)