Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed handling of XML-RPC faults and adjusted test case to match the

expected behaviour.
  • Loading branch information...
commit 44e524ca0539d163c0849ca4995dd061e9add4a4 1 parent ce6272b
@chris-allan chris-allan authored committed
Showing with 10 additions and 4 deletions.
  1. +5 −2 tests/xml.py
  2. +5 −2 tornadorpc/xml.py
View
7 tests/xml.py
@@ -89,6 +89,9 @@ class XMLRPCTests(RPCTests, unittest.TestCase):
def test_private(self):
client = self.get_client()
- result = client.private()
- self.assertTrue(result['faultCode'] == -32601)
+ try:
+ client.private()
+ self.fail("xmlrpclib.Fault should have been raised")
+ except xmlrpclib.Fault, f:
+ self.assertEqual(-32601, f.faultCode)
View
7 tornadorpc/xml.py
@@ -63,8 +63,11 @@ def parse_request(self, request_body):
return ((method_name, params),)
def parse_responses(self, responses):
- if isinstance(responses, xmlrpclib.Fault):
- return xmlrpclib.dumps(responses)
+ try:
+ if isinstance(responses[0], xmlrpclib.Fault):
+ return xmlrpclib.dumps(responses[0])
+ except IndexError:
+ pass
try:
response_xml = xmlrpclib.dumps(responses, methodresponse=True)
except TypeError:
Please sign in to comment.
Something went wrong with that request. Please try again.