mirror of
https://github.com/searxng/searxng.git
synced 2025-08-03 10:32:21 +02:00
[fix] bing unicode encode error - fixes #408
This commit is contained in:
parent
b9c8039d74
commit
604f32f672
6 changed files with 18 additions and 18 deletions
|
@ -28,10 +28,10 @@ class TestBingNewsEngine(SearxTestCase):
|
|||
self.assertRaises(AttributeError, bing_news.response, '')
|
||||
self.assertRaises(AttributeError, bing_news.response, '[]')
|
||||
|
||||
response = mock.Mock(content='<html></html>')
|
||||
response = mock.Mock(text='<html></html>')
|
||||
self.assertEqual(bing_news.response(response), [])
|
||||
|
||||
response = mock.Mock(content='<html></html>')
|
||||
response = mock.Mock(text='<html></html>')
|
||||
self.assertEqual(bing_news.response(response), [])
|
||||
|
||||
html = """<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
@ -66,7 +66,7 @@ class TestBingNewsEngine(SearxTestCase):
|
|||
</item>
|
||||
</channel>
|
||||
</rss>""" # noqa
|
||||
response = mock.Mock(content=html)
|
||||
response = mock.Mock(text=html)
|
||||
results = bing_news.response(response)
|
||||
self.assertEqual(type(results), list)
|
||||
self.assertEqual(len(results), 2)
|
||||
|
@ -105,7 +105,7 @@ class TestBingNewsEngine(SearxTestCase):
|
|||
</item>
|
||||
</channel>
|
||||
</rss>""" # noqa
|
||||
response = mock.Mock(content=html)
|
||||
response = mock.Mock(text=html)
|
||||
results = bing_news.response(response)
|
||||
self.assertEqual(type(results), list)
|
||||
self.assertEqual(len(results), 1)
|
||||
|
@ -128,11 +128,11 @@ class TestBingNewsEngine(SearxTestCase):
|
|||
</channel>
|
||||
</rss>""" # noqa
|
||||
|
||||
response = mock.Mock(content=html)
|
||||
response = mock.Mock(text=html)
|
||||
results = bing_news.response(response)
|
||||
self.assertEqual(type(results), list)
|
||||
self.assertEqual(len(results), 0)
|
||||
|
||||
html = """<?xml version="1.0" encoding="utf-8" ?>gabarge"""
|
||||
response = mock.Mock(content=html)
|
||||
response = mock.Mock(text=html)
|
||||
self.assertRaises(lxml.etree.XMLSyntaxError, bing_news.response, response)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue