def test_loginConnectionRefused(self):
"""
L{PBClientFactory.login} returns a L{Deferred} which is errbacked
with the L{ConnectionRefusedError} if the underlying connection is
refused.
"""
clientFactory = pb.PBClientFactory()
loginDeferred = clientFactory.login(
credentials.UsernamePassword(b"foo", b"bar"))
clientFactory.clientConnectionFailed(
None,
failure.Failure(
ConnectionRefusedError("Test simulated refused connection")))
return self.assertFailure(loginDeferred, ConnectionRefusedError)
评论列表
文章目录