def test_deferredOnInitialized(self): """ Test the factory's deferred on stream initialization. """ f = DeferredClientFactory(JID('*****@*****.**'), 'secret') xmlstream = f.buildProtocol(None) xmlstream.dispatch(xmlstream, STREAM_AUTHD_EVENT) return f.deferred
def test_deferredOnConnectionFailure(self): """ Test the factory's deferred on connection faulure. """ f = DeferredClientFactory(JID('*****@*****.**'), 'secret') xmlstream = f.buildProtocol(None) class TestException(Exception): pass f.clientConnectionFailed(self, TestException()) self.assertFailure(f.deferred, TestException) return f.deferred
def test_deferredOnNotInitialized(self): """ Test the factory's deferred on failed stream initialization. """ f = DeferredClientFactory(JID('*****@*****.**'), 'secret') xmlstream = f.buildProtocol(None) class TestException(Exception): pass xmlstream.dispatch(TestException(), INIT_FAILED_EVENT) self.assertFailure(f.deferred, TestException) return f.deferred