Ignore:
Timestamp:
Aug 22, 2007, 5:00:48 PM (15 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@5
Message:

Reverse how handlers are associated with the stream manager. Kick version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_subprotocols.py

    r1 r4  
    2222
    2323
    24 class DummyXMPPHandler(object):
     24class DummyXMPPHandler(subprotocols.XMPPHandler):
    2525    def __init__(self):
    2626        self.doneMade = 0
     
    5656
    5757        handler = subprotocols.XMPPHandler()
    58         handler.manager = DummyStreamManager()
     58        handler.parent = DummyStreamManager()
    5959        handler.send('<presence/>')
    60         self.assertEquals(['<presence/>'], handler.manager.outlist)
     60        self.assertEquals(['<presence/>'], handler.parent.outlist)
    6161
    6262
     
    9090        sm = self.streamManager
    9191        handler = DummyXMPPHandler()
    92         sm.addHandler(handler)
     92        handler.setHandlerParent(sm)
    9393        xs = xmlstream.XmlStream(xmlstream.Authenticator())
    9494        sm._connected(xs)
     
    104104        sm = self.streamManager
    105105        handler = DummyXMPPHandler()
    106         sm.addHandler(handler)
     106        handler.setHandlerParent(sm)
    107107        xs = xmlstream.XmlStream(xmlstream.Authenticator())
    108108        sm._authd(xs)
     
    118118        sm = self.streamManager
    119119        handler = DummyXMPPHandler()
    120         sm.addHandler(handler)
     120        handler.setHandlerParent(sm)
    121121        xs = xmlstream.XmlStream(xmlstream.Authenticator())
    122122        sm._disconnected(xs)
     
    131131        sm = self.streamManager
    132132        handler = DummyXMPPHandler()
    133         sm.addHandler(handler)
     133        handler.setHandlerParent(sm)
    134134        self.assertIn(handler, sm)
    135         self.assertIdentical(sm, handler.manager)
     135        self.assertIdentical(sm, handler.parent)
    136136
    137137        self.assertEquals(0, handler.doneMade)
     
    153153        sm._authd(xs)
    154154        handler = DummyXMPPHandler()
    155         sm.addHandler(handler)
     155        handler.setHandlerParent(sm)
    156156
    157157        self.assertEquals(1, handler.doneMade)
     
    165165        sm = self.streamManager
    166166        handler = DummyXMPPHandler()
    167         sm.addHandler(handler)
    168         sm.removeHandler(handler)
     167        handler.setHandlerParent(sm)
     168        handler.disownHandlerParent(sm)
    169169        self.assertNotIn(handler, sm)
    170         self.assertIdentical(None, handler.manager)
     170        self.assertIdentical(None, handler.parent)
    171171
    172172    def test_sendInitialized(self):
Note: See TracChangeset for help on using the changeset viewer.