Changeset 74:355afce3af27 in ralphm-patches for server-stream-manager.patch
- Timestamp:
- Aug 19, 2014, 4:31:19 PM (8 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server-stream-manager.patch
r72 r74 1 1 # HG changeset patch 2 # Parent 3f3fe954b1975c2d9115e0fa8177ae7b28a708a82 # Parent 71082c22f73200a0b8b4b5c6e5d2773f9f68dd4d 3 3 Generalize StreamManager and add ServerStreamManager. 4 4 … … 32 32 33 33 def initializationFailed(self, reason): 34 diff --git a/wokkel/component.py b/wokkel/component.py 35 --- a/wokkel/component.py 36 +++ b/wokkel/component.py 37 @@ -36,7 +36,7 @@ 38 StreamManager.__init__(self, factory) 39 40 41 - def _authd(self, xs): 42 + def connectionInitialized(self, xs): 43 """ 44 Called when stream initialization has completed. 45 46 @@ -53,7 +53,7 @@ 47 old_send(obj) 48 49 xs.send = send 50 - StreamManager._authd(self, xs) 51 + StreamManager.connectionInitialized(self, xs) 52 53 54 def initializationFailed(self, reason): 34 55 diff --git a/wokkel/subprotocols.py b/wokkel/subprotocols.py 35 56 --- a/wokkel/subprotocols.py 36 57 +++ b/wokkel/subprotocols.py 37 @@ -1 18,7 +118,7 @@58 @@ -120,7 +120,7 @@ 38 59 39 60 … … 44 65 Business logic representing a managed XMPP connection. 45 66 46 @@ -1 29,43 +129,39 @@67 @@ -131,43 +131,39 @@ 47 68 48 69 @ivar xmlstream: currently managed XML stream … … 95 116 from twisted.internet import reactor 96 117 self._reactor = reactor 97 @@ -19 1,7 +187,7 @@118 @@ -193,7 +189,7 @@ 98 119 handler.connectionInitialized() 99 120 … … 104 125 Called when the transport connection has been established. 105 126 106 @@ -2 09,13 +205,17 @@127 @@ -211,13 +207,17 @@ 107 128 xs.rawDataInFn = logDataIn 108 129 xs.rawDataOutFn = logDataOut … … 123 144 Called when the stream has been initialized. 124 145 125 @@ -2 38,21 +238,8 @@146 @@ -240,21 +240,8 @@ 126 147 e.connectionInitialized() 127 148 … … 146 167 Called when the stream has been closed. 147 168 148 @@ - 379,6 +366,60 @@169 @@ -464,6 +451,60 @@ 149 170 150 171 … … 230 251 231 252 253 diff --git a/wokkel/test/test_component.py b/wokkel/test/test_component.py 254 --- a/wokkel/test/test_component.py 255 +++ b/wokkel/test/test_component.py 256 @@ -49,11 +49,18 @@ 257 def __init__(self, *args, **kwargs): 258 component.Component.__init__(self, *args, **kwargs) 259 self.factory.clock = Clock() 260 + self.output = [] 261 262 263 def _getConnection(self): 264 c = FakeConnector(self.factory, None, None) 265 c.connect() 266 + xs = self.factory.buildProtocol(None) 267 + xs.send = self.output.append 268 + xs.connectionMade() 269 + self.makeConnection(xs) 270 + xs.thisEntity = xs.otherEntity 271 + xs.dispatch(xs, xmlstream.STREAM_AUTHD_EVENT) 272 return c 273 274 275 @@ -104,6 +111,21 @@ 276 self.assertEqual(1, connector.connects) 277 278 279 + def test_stampFrom(self): 280 + """ 281 + Outgoing elements with missing sender address get component JID. 282 + """ 283 + comp = TestableComponent('example.org', 5347, 284 + 'test.example.org', 'secret') 285 + comp.startService() 286 + 287 + element = domish.Element((component.NS_COMPONENT_ACCEPT, "message")) 288 + element["to"] = "test@example.org" 289 + comp.xmlstream.send(element) 290 + 291 + self.assertEqual('test.example.org', element.getAttribute("from")) 292 + 293 + 294 295 class InternalComponentTest(unittest.TestCase): 296 """ 232 297 diff --git a/wokkel/test/test_subprotocols.py b/wokkel/test/test_subprotocols.py 233 298 --- a/wokkel/test/test_subprotocols.py
Note: See TracChangeset
for help on using the changeset viewer.