|  | @@ -22,37 +22,64 @@ class TestGigablastEngine(SearxTestCase):
 | 
	
		
			
			| 22 | 22 |          self.assertRaises(AttributeError, gigablast.response, '')
 | 
	
		
			
			| 23 | 23 |          self.assertRaises(AttributeError, gigablast.response, '[]')
 | 
	
		
			
			| 24 | 24 |  
 | 
	
		
			
			| 25 |  | -        response = mock.Mock(content='<response></response>')
 | 
	
		
			
			|  | 25 | +        response = mock.Mock(text='{"results": []}')
 | 
	
		
			
			| 26 | 26 |          self.assertEqual(gigablast.response(response), [])
 | 
	
		
			
			| 27 | 27 |  
 | 
	
		
			
			| 28 |  | -        response = mock.Mock(content='<response></response>')
 | 
	
		
			
			| 29 |  | -        self.assertEqual(gigablast.response(response), [])
 | 
	
		
			
			| 30 |  | -
 | 
	
		
			
			| 31 |  | -        xml = """<?xml version="1.0" encoding="UTF-8" ?>
 | 
	
		
			
			| 32 |  | -        <response>
 | 
	
		
			
			| 33 |  | -            <hits>5941888</hits>
 | 
	
		
			
			| 34 |  | -            <moreResultsFollow>1</moreResultsFollow>
 | 
	
		
			
			| 35 |  | -            <result>
 | 
	
		
			
			| 36 |  | -                <title><![CDATA[This should be the title]]></title>
 | 
	
		
			
			| 37 |  | -                <sum><![CDATA[This should be the content.]]></sum>
 | 
	
		
			
			| 38 |  | -                <url><![CDATA[http://this.should.be.the.link/]]></url>
 | 
	
		
			
			| 39 |  | -                <size>90.5</size>
 | 
	
		
			
			| 40 |  | -                <docId>145414002633</docId>
 | 
	
		
			
			| 41 |  | -                <siteId>2660021087</siteId>
 | 
	
		
			
			| 42 |  | -                <domainId>2660021087</domainId>
 | 
	
		
			
			| 43 |  | -                <spidered>1320519373</spidered>
 | 
	
		
			
			| 44 |  | -                <indexed>1320519373</indexed>
 | 
	
		
			
			| 45 |  | -                <pubdate>4294967295</pubdate>
 | 
	
		
			
			| 46 |  | -                <isModDate>0</isModDate>
 | 
	
		
			
			| 47 |  | -                <language><![CDATA[English]]></language>
 | 
	
		
			
			| 48 |  | -                <charset><![CDATA[UTF-8]]></charset>
 | 
	
		
			
			| 49 |  | -            </result>
 | 
	
		
			
			| 50 |  | -        </response>
 | 
	
		
			
			|  | 28 | +        json = """{"results": [
 | 
	
		
			
			|  | 29 | +    {
 | 
	
		
			
			|  | 30 | +        "title":"South by Southwest 2016 Music, Film and Interactive Festivals - Austin Texas",
 | 
	
		
			
			|  | 31 | +        "dmozEntry":{
 | 
	
		
			
			|  | 32 | +            "dmozCatId":1041152,
 | 
	
		
			
			|  | 33 | +            "directCatId":1,
 | 
	
		
			
			|  | 34 | +            "dmozCatStr":"Top: Regional: North America: United States: Texas: Arts and Entertainment: Events",
 | 
	
		
			
			|  | 35 | +            "dmozTitle":"South by Southwest (SXSW)",
 | 
	
		
			
			|  | 36 | +            "dmozSum":"Annual music, film, and interactive conference and festival held in Austin. Includes schedules and band and film lists.",
 | 
	
		
			
			|  | 37 | +            "dmozAnchor":""
 | 
	
		
			
			|  | 38 | +        },
 | 
	
		
			
			|  | 39 | +        "dmozEntry":{
 | 
	
		
			
			|  | 40 | +            "dmozCatId":763945,
 | 
	
		
			
			|  | 41 | +            "directCatId":1,
 | 
	
		
			
			|  | 42 | +            "dmozCatStr":"Top: Regional: North America: United States: Texas: Localities: A: Austin: Arts and Entertainment: Events",
 | 
	
		
			
			|  | 43 | +            "dmozTitle":"South by Southwest (SXSW)",
 | 
	
		
			
			|  | 44 | +            "dmozSum":"",
 | 
	
		
			
			|  | 45 | +            "dmozAnchor":"www.sxsw.com"
 | 
	
		
			
			|  | 46 | +        },
 | 
	
		
			
			|  | 47 | +        "dmozEntry":{
 | 
	
		
			
			|  | 48 | +            "dmozCatId":761446,
 | 
	
		
			
			|  | 49 | +            "directCatId":1,
 | 
	
		
			
			|  | 50 | +            "dmozCatStr":"Top: Regional: North America: United States: Texas: Travel and Tourism: Attractions",
 | 
	
		
			
			|  | 51 | +            "dmozTitle":"South by Southwest (SXSW)",
 | 
	
		
			
			|  | 52 | +            "dmozSum":"Music, film, and interactive conference and festival. Includes schedules and band and film lists.",
 | 
	
		
			
			|  | 53 | +            "dmozAnchor":""
 | 
	
		
			
			|  | 54 | +        },
 | 
	
		
			
			|  | 55 | +        "indirectDmozCatId":1041152,
 | 
	
		
			
			|  | 56 | +        "indirectDmozCatId":763945,
 | 
	
		
			
			|  | 57 | +        "indirectDmozCatId":761446,
 | 
	
		
			
			|  | 58 | +        "contentType":"html",
 | 
	
		
			
			|  | 59 | +        "sum":"This should be the content.",
 | 
	
		
			
			|  | 60 | +        "url":"www.sxsw.com",
 | 
	
		
			
			|  | 61 | +        "hopCount":0,
 | 
	
		
			
			|  | 62 | +        "size":" 102k",
 | 
	
		
			
			|  | 63 | +        "sizeInBytes":104306,
 | 
	
		
			
			|  | 64 | +        "bytesUsedToComputeSummary":70000,
 | 
	
		
			
			|  | 65 | +        "docId":269411794364,
 | 
	
		
			
			|  | 66 | +        "docScore":586571136.000000,
 | 
	
		
			
			|  | 67 | +        "summaryGenTimeMS":12,
 | 
	
		
			
			|  | 68 | +        "summaryTagdbLookupTimeMS":0,
 | 
	
		
			
			|  | 69 | +        "summaryTitleRecLoadTimeMS":1,
 | 
	
		
			
			|  | 70 | +        "site":"www.sxsw.com",
 | 
	
		
			
			|  | 71 | +        "spidered":1452203608,
 | 
	
		
			
			|  | 72 | +        "firstIndexedDateUTC":1444167123,
 | 
	
		
			
			|  | 73 | +        "contentHash32":2170650347,
 | 
	
		
			
			|  | 74 | +        "language":"English",
 | 
	
		
			
			|  | 75 | +        "langAbbr":"en"
 | 
	
		
			
			|  | 76 | +    }
 | 
	
		
			
			|  | 77 | +]}
 | 
	
		
			
			| 51 | 78 |          """
 | 
	
		
			
			| 52 |  | -        response = mock.Mock(content=xml)
 | 
	
		
			
			|  | 79 | +        response = mock.Mock(text=json)
 | 
	
		
			
			| 53 | 80 |          results = gigablast.response(response)
 | 
	
		
			
			| 54 | 81 |          self.assertEqual(type(results), list)
 | 
	
		
			
			| 55 | 82 |          self.assertEqual(len(results), 1)
 | 
	
		
			
			| 56 |  | -        self.assertEqual(results[0]['title'], 'This should be the title')
 | 
	
		
			
			| 57 |  | -        self.assertEqual(results[0]['url'], 'http://this.should.be.the.link/')
 | 
	
		
			
			|  | 83 | +        self.assertEqual(results[0]['title'], 'South by Southwest 2016 Music, Film and Interactive Festivals - Austin Texas')
 | 
	
		
			
			|  | 84 | +        self.assertEqual(results[0]['url'], 'www.sxsw.com')
 | 
	
		
			
			| 58 | 85 |          self.assertEqual(results[0]['content'], 'This should be the content.')
 |