source:
ralphm-patches/request-xmpphandler.patch
@
53:fd2b3f70b221
Last change on this file since 53:fd2b3f70b221 was 53:fd2b3f70b221, checked in by Ralph Meijer <ralphm@…>, 9 years ago | |
---|---|
File size: 2.2 KB |
-
wokkel/subprotocols.py
# HG changeset patch # Parent 4d60ea3a5ab59d48e5080c913f6aeea9af55fccb Add request method to XMPPHandler, passing up to its StreamManager. diff -r 4d60ea3a5ab5 wokkel/subprotocols.py
a b 94 94 self.parent.send(obj) 95 95 96 96 97 def request(self, request): 98 """ 99 Send an IQ request and track the response. 100 101 This passes the request to the parent for sending and response 102 tracking. 103 104 @see: L{StreamManager.request}. 105 """ 106 return self.parent.request(request) 107 108 97 109 98 110 class XMPPHandlerCollection(object): 99 111 """ -
wokkel/test/test_subprotocols.py
diff -r 4d60ea3a5ab5 wokkel/test/test_subprotocols.py
a b 71 71 72 72 73 73 74 class IQGetStanza(generic.Stanza): 75 timeout = None 76 77 stanzaKind = 'iq' 78 stanzaType = 'get' 79 stanzaID = 'test' 80 81 82 74 83 class XMPPHandlerTest(unittest.TestCase): 75 84 """ 76 85 Tests for L{subprotocols.XMPPHandler}. … … 126 135 self.assertIdentical(None, handler.xmlstream) 127 136 128 137 138 def test_request(self): 139 """ 140 A request is passed up to the stream manager. 141 """ 142 class DummyStreamManager(object): 143 def __init__(self): 144 self.requests = [] 145 146 def request(self, request): 147 self.requests.append(request) 148 return defer.succeed(None) 149 150 handler = subprotocols.XMPPHandler() 151 handler.parent = DummyStreamManager() 152 request = IQGetStanza() 153 d = handler.request(request) 154 self.assertEquals(1, len(handler.parent.requests)) 155 self.assertIdentical(request, handler.parent.requests[-1]) 156 return d 157 158 129 159 130 160 class XMPPHandlerCollectionTest(unittest.TestCase): 131 161 """ … … 165 195 166 196 167 197 168 class IQGetStanza(generic.Stanza):169 stanzaKind = 'iq'170 stanzaType = 'get'171 stanzaID = 'test'172 173 174 175 198 class StreamManagerTest(unittest.TestCase): 176 199 """ 177 200 Tests for L{subprotocols.StreamManager}.
Note: See TracBrowser
for help on using the repository browser.