mirror of https://github.com/searxng/searxng.git
[fix] missing gigablast tests
This commit is contained in:
parent
ebbf33343a
commit
33ff1de9be
|
@ -22,37 +22,64 @@ class TestGigablastEngine(SearxTestCase):
|
||||||
self.assertRaises(AttributeError, gigablast.response, '')
|
self.assertRaises(AttributeError, gigablast.response, '')
|
||||||
self.assertRaises(AttributeError, gigablast.response, '[]')
|
self.assertRaises(AttributeError, gigablast.response, '[]')
|
||||||
|
|
||||||
response = mock.Mock(content='<response></response>')
|
response = mock.Mock(text='{"results": []}')
|
||||||
self.assertEqual(gigablast.response(response), [])
|
self.assertEqual(gigablast.response(response), [])
|
||||||
|
|
||||||
response = mock.Mock(content='<response></response>')
|
json = """{"results": [
|
||||||
self.assertEqual(gigablast.response(response), [])
|
{
|
||||||
|
"title":"South by Southwest 2016 Music, Film and Interactive Festivals - Austin Texas",
|
||||||
xml = """<?xml version="1.0" encoding="UTF-8" ?>
|
"dmozEntry":{
|
||||||
<response>
|
"dmozCatId":1041152,
|
||||||
<hits>5941888</hits>
|
"directCatId":1,
|
||||||
<moreResultsFollow>1</moreResultsFollow>
|
"dmozCatStr":"Top: Regional: North America: United States: Texas: Arts and Entertainment: Events",
|
||||||
<result>
|
"dmozTitle":"South by Southwest (SXSW)",
|
||||||
<title><![CDATA[This should be the title]]></title>
|
"dmozSum":"Annual music, film, and interactive conference and festival held in Austin. Includes schedules and band and film lists.",
|
||||||
<sum><![CDATA[This should be the content.]]></sum>
|
"dmozAnchor":""
|
||||||
<url><![CDATA[http://this.should.be.the.link/]]></url>
|
},
|
||||||
<size>90.5</size>
|
"dmozEntry":{
|
||||||
<docId>145414002633</docId>
|
"dmozCatId":763945,
|
||||||
<siteId>2660021087</siteId>
|
"directCatId":1,
|
||||||
<domainId>2660021087</domainId>
|
"dmozCatStr":"Top: Regional: North America: United States: Texas: Localities: A: Austin: Arts and Entertainment: Events",
|
||||||
<spidered>1320519373</spidered>
|
"dmozTitle":"South by Southwest (SXSW)",
|
||||||
<indexed>1320519373</indexed>
|
"dmozSum":"",
|
||||||
<pubdate>4294967295</pubdate>
|
"dmozAnchor":"www.sxsw.com"
|
||||||
<isModDate>0</isModDate>
|
},
|
||||||
<language><![CDATA[English]]></language>
|
"dmozEntry":{
|
||||||
<charset><![CDATA[UTF-8]]></charset>
|
"dmozCatId":761446,
|
||||||
</result>
|
"directCatId":1,
|
||||||
</response>
|
"dmozCatStr":"Top: Regional: North America: United States: Texas: Travel and Tourism: Attractions",
|
||||||
|
"dmozTitle":"South by Southwest (SXSW)",
|
||||||
|
"dmozSum":"Music, film, and interactive conference and festival. Includes schedules and band and film lists.",
|
||||||
|
"dmozAnchor":""
|
||||||
|
},
|
||||||
|
"indirectDmozCatId":1041152,
|
||||||
|
"indirectDmozCatId":763945,
|
||||||
|
"indirectDmozCatId":761446,
|
||||||
|
"contentType":"html",
|
||||||
|
"sum":"This should be the content.",
|
||||||
|
"url":"www.sxsw.com",
|
||||||
|
"hopCount":0,
|
||||||
|
"size":" 102k",
|
||||||
|
"sizeInBytes":104306,
|
||||||
|
"bytesUsedToComputeSummary":70000,
|
||||||
|
"docId":269411794364,
|
||||||
|
"docScore":586571136.000000,
|
||||||
|
"summaryGenTimeMS":12,
|
||||||
|
"summaryTagdbLookupTimeMS":0,
|
||||||
|
"summaryTitleRecLoadTimeMS":1,
|
||||||
|
"site":"www.sxsw.com",
|
||||||
|
"spidered":1452203608,
|
||||||
|
"firstIndexedDateUTC":1444167123,
|
||||||
|
"contentHash32":2170650347,
|
||||||
|
"language":"English",
|
||||||
|
"langAbbr":"en"
|
||||||
|
}
|
||||||
|
]}
|
||||||
"""
|
"""
|
||||||
response = mock.Mock(content=xml)
|
response = mock.Mock(text=json)
|
||||||
results = gigablast.response(response)
|
results = gigablast.response(response)
|
||||||
self.assertEqual(type(results), list)
|
self.assertEqual(type(results), list)
|
||||||
self.assertEqual(len(results), 1)
|
self.assertEqual(len(results), 1)
|
||||||
self.assertEqual(results[0]['title'], 'This should be the title')
|
self.assertEqual(results[0]['title'], 'South by Southwest 2016 Music, Film and Interactive Festivals - Austin Texas')
|
||||||
self.assertEqual(results[0]['url'], 'http://this.should.be.the.link/')
|
self.assertEqual(results[0]['url'], 'www.sxsw.com')
|
||||||
self.assertEqual(results[0]['content'], 'This should be the content.')
|
self.assertEqual(results[0]['content'], 'This should be the content.')
|
||||||
|
|
Loading…
Reference in New Issue