def test_exposed_preprocessor(self):
d = defer.Deferred()
def pp(hr, sr):
self.assertEqual(hr, 'hello')
self.assertIdentical(sr, self.service_request)
d.callback(None)
pp = gateway.expose_request(pp)
gw = twisted.TwistedGateway({'echo': lambda x: x}, preprocessor=pp)
self.service_request = gateway.ServiceRequest(
None, gw.services['echo'], None
)
gw.preprocessRequest(self.service_request, http_request='hello')
return d
test_twisted.py 文件源码
python
阅读 39
收藏 0
点赞 0
评论 0
评论列表
文章目录