Esempio n. 1
0
    def setUp(self):
        self.request = DummyRequest([''])
        self.request.method = 'POST'
        self.request.content = NativeStringIO(
            payloadTemplate % ('async', xmlrpclib.dumps(())))

        result = self.result = defer.Deferred()
        class AsyncResource(XMLRPC):
            def xmlrpc_async(self):
                return result

        self.resource = AsyncResource()
Esempio n. 2
0
 def setUp(self):
     # The _QueryFactory that we are testing. We don't care about any
     # of the constructor parameters.
     self.queryFactory = _QueryFactory(
         path=None, host=None, method='POST', user=None, password=None,
         allowNone=False, args=())
     # An XML-RPC response that will parse without raising an error.
     self.goodContents = xmlrpclib.dumps(('',))
     # An 'XML-RPC response' that will raise a parsing error.
     self.badContents = 'invalid xml'
     # A dummy 'reason' to pass to clientConnectionLost. We don't care
     # what it is.
     self.reason = failure.Failure(ConnectionDone())
Esempio n. 3
0
 def test_withRequest(self):
     """
     When an XML-RPC method is called and the implementation is
     decorated with L{withRequest}, the request object is passed as
     the first argument.
     """
     request = DummyRequest('/RPC2')
     request.method = "POST"
     request.content = NativeStringIO(xmlrpclib.dumps(
         ("foo",), 'withRequest'))
     def valid(n, request):
         data = xmlrpclib.loads(request.written[0])
         self.assertEqual(data, (('POST foo',), None))
     d = request.notifyFinish().addCallback(valid, request)
     self.resource.render_POST(request)
     return d