Example #1
0
    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
Example #2
0
    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
Example #3
0
    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
Example #4
0
    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
Example #5
0
    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
Example #6
0
    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