mirror of
https://github.com/searxng/searxng
synced 2024-11-07 03:20:28 +00:00
Merge pull request #395 from gugod/master
btdigg engine: fix text mojibake.
This commit is contained in:
commit
911ed7987c
@ -38,7 +38,7 @@ def request(query, params):
|
|||||||
def response(resp):
|
def response(resp):
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
dom = html.fromstring(resp.text)
|
dom = html.fromstring(resp.content)
|
||||||
|
|
||||||
search_res = dom.xpath('//div[@id="search_res"]/table/tr')
|
search_res = dom.xpath('//div[@id="search_res"]/table/tr')
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class TestBtdiggEngine(SearxTestCase):
|
|||||||
self.assertRaises(AttributeError, btdigg.response, '')
|
self.assertRaises(AttributeError, btdigg.response, '')
|
||||||
self.assertRaises(AttributeError, btdigg.response, '[]')
|
self.assertRaises(AttributeError, btdigg.response, '[]')
|
||||||
|
|
||||||
response = mock.Mock(text='<html></html>')
|
response = mock.Mock(content='<html></html>')
|
||||||
self.assertEqual(btdigg.response(response), [])
|
self.assertEqual(btdigg.response(response), [])
|
||||||
|
|
||||||
html = """
|
html = """
|
||||||
@ -82,7 +82,7 @@ class TestBtdiggEngine(SearxTestCase):
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
response = mock.Mock(text=html)
|
response = mock.Mock(content=html)
|
||||||
results = btdigg.response(response)
|
results = btdigg.response(response)
|
||||||
self.assertEqual(type(results), list)
|
self.assertEqual(type(results), list)
|
||||||
self.assertEqual(len(results), 1)
|
self.assertEqual(len(results), 1)
|
||||||
@ -101,7 +101,7 @@ class TestBtdiggEngine(SearxTestCase):
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
response = mock.Mock(text=html)
|
response = mock.Mock(content=html)
|
||||||
results = btdigg.response(response)
|
results = btdigg.response(response)
|
||||||
self.assertEqual(type(results), list)
|
self.assertEqual(type(results), list)
|
||||||
self.assertEqual(len(results), 0)
|
self.assertEqual(len(results), 0)
|
||||||
@ -367,7 +367,7 @@ class TestBtdiggEngine(SearxTestCase):
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
response = mock.Mock(text=html)
|
response = mock.Mock(content=html)
|
||||||
results = btdigg.response(response)
|
results = btdigg.response(response)
|
||||||
self.assertEqual(type(results), list)
|
self.assertEqual(type(results), list)
|
||||||
self.assertEqual(len(results), 5)
|
self.assertEqual(len(results), 5)
|
||||||
|
Loading…
Reference in New Issue
Block a user