当前位置: 首页>>代码示例>>Python>>正文


Python DummyRequest.processingFailed方法代码示例

本文整理汇总了Python中twisted.web.test.test_web.DummyRequest.processingFailed方法的典型用法代码示例。如果您正苦于以下问题:Python DummyRequest.processingFailed方法的具体用法?Python DummyRequest.processingFailed怎么用?Python DummyRequest.processingFailed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.web.test.test_web.DummyRequest的用法示例。


在下文中一共展示了DummyRequest.processingFailed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: AsyncXMLRPCTests

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import processingFailed [as 别名]
class AsyncXMLRPCTests(unittest.TestCase):
    """
    Tests for L{XMLRPC}'s support of Deferreds.
    """
    def setUp(self):
        self.request = DummyRequest([''])
        self.request.method = 'POST'
        self.request.content = StringIO(
            payloadTemplate % ('async', xmlrpclib.dumps(())))

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

        self.resource = AsyncResource()


    def test_deferredResponse(self):
        """
        If an L{XMLRPC} C{xmlrpc_*} method returns a L{defer.Deferred}, the
        response to the request is the result of that L{defer.Deferred}.
        """
        self.resource.render(self.request)
        self.assertEquals(self.request.written, [])

        self.result.callback("result")

        resp = xmlrpclib.loads("".join(self.request.written))
        self.assertEquals(resp, (('result',), None))
        self.assertEquals(self.request.finished, 1)


    def test_interruptedDeferredResponse(self):
        """
        While waiting for the L{Deferred} returned by an L{XMLRPC} C{xmlrpc_*}
        method to fire, the connection the request was issued over may close.
        If this happens, neither C{write} nor C{finish} is called on the
        request.
        """
        self.resource.render(self.request)
        self.request.processingFailed(
            failure.Failure(ConnectionDone("Simulated")))
        self.result.callback("result")
        self.assertEquals(self.request.written, [])
        self.assertEquals(self.request.finished, 0)
开发者ID:jdb,项目名称:twisted,代码行数:48,代码来源:test_xmlrpc.py

示例2: processingFailed

# 需要导入模块: from twisted.web.test.test_web import DummyRequest [as 别名]
# 或者: from twisted.web.test.test_web.DummyRequest import processingFailed [as 别名]
	def processingFailed(self, reason):
		self._disconnected = True
		_TwistedDummyRequest.processingFailed(self, reason)
开发者ID:ludios,项目名称:Webmagic,代码行数:5,代码来源:fakes.py


注:本文中的twisted.web.test.test_web.DummyRequest.processingFailed方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。