def test_WillDecodeResponseDataAsJSON(self):
     self.force_http_status(200, 'Success', self.test_data_str)
     op = JSONRESTOperation('GET', self.test_url)
     op.execute()
     self.assertEqual(self.test_data, op.response)
 def test_WillEncodeRequestDataAsJSON(self):
     self.force_http_status(200, 'Success')
     op = JSONRESTOperation('GET', self.test_url, self.test_data)
     op.execute()
     self.mock_HTTPConnection().\
         request.assert_called_with('GET', '/', self.test_data_str, {})
Example #3
0
 def make_json_request(self, method, url, data=''):
     headers = {'Accept' : 'application/json'}
     op = JSONRESTOperation(method, url, data, headers)
     op.execute()
     return  op