Changeset 61:5a5840e066fb


Ignore:
Timestamp:
Jun 12, 2009, 5:32:06 PM (11 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@173
Message:

Fix regression that made DeferredClientFactory? have no stream manager.

Author: ralphm.
Fixes #51.

Location:
wokkel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wokkel/client.py

    r55 r61  
    129129        authenticator = client.XMPPAuthenticator(jid, password)
    130130        generic.DeferredXmlStreamFactory.__init__(self, authenticator)
     131        self.streamManager = StreamManager(self)
    131132
    132133
  • wokkel/test/test_client.py

    r42 r61  
    1313from twisted.words.protocols.jabber.xmlstream import STREAM_AUTHD_EVENT
    1414from twisted.words.protocols.jabber.xmlstream import INIT_FAILED_EVENT
     15
     16try:
     17    from twisted.words.protocols.jabber.xmlstream import XMPPHandler
     18except ImportError:
     19    from wokkel.subprotocols import XMPPHandler
    1520
    1621from wokkel import client
     
    7883
    7984
     85    def test_addHandler(self):
     86        """
     87        Test the addition of a protocol handler.
     88        """
     89        handler = XMPPHandler()
     90        handler.setHandlerParent(self.factory.streamManager)
     91        self.assertIn(handler, self.factory.streamManager)
     92        self.assertIdentical(self.factory.streamManager, handler.parent)
     93
     94
     95    def test_removeHandler(self):
     96        """
     97        Test removal of a protocol handler.
     98        """
     99        handler = XMPPHandler()
     100        handler.setHandlerParent(self.factory.streamManager)
     101        handler.disownHandlerParent(self.factory.streamManager)
     102        self.assertNotIn(handler, self.factory.streamManager)
     103        self.assertIdentical(None, handler.parent)
     104
     105
    80106
    81107class ClientCreatorTest(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.