Exemple #1
0
 def test_invalid_json(self):
     self.response.content = '{"this:"is", "json":true}'
     resp = APIResponseWrapper(response=self.response)
     #because its a property you have to make it a function
     self.assertRaises(
         ValueError,
         lambda: resp.json,
     )
Exemple #2
0
 def test_invalid_xml(self):
     self.response.content = self.XML[:50]
     resp = APIResponseWrapper(response=self.response)
     self.assertRaises(ValueError, lambda: resp.xml)
Exemple #3
0
 def test_xml(self):
     self.response.content = self.XML
     resp = APIResponseWrapper(response=self.response)
     title = resp.xml.getchildren()[0].getchildren()[0].text
     self.assertEquals(title, 'Whoops - Pivotal Tracker')
Exemple #4
0
 def test_json(self):
     self.response.content = '{"this":"is", "json":true}'
     print self.response.content
     resp = APIResponseWrapper(response=self.response)
     self.assertEquals(json.loads(self.response.content), resp.json)