Browse Source

fixed regression introduced in latest release with ack ids

pull/5/head
Miguel Grinberg 10 years ago
parent
commit
4a4ba41d0c
  1. 2
      socketio/base_manager.py
  2. 4
      tests/test_base_manager.py

2
socketio/base_manager.py

@ -94,7 +94,7 @@ class BaseManager(object):
for sid in self.get_participants(namespace, room):
if sid != skip_sid:
if callback is not None:
id = self.server._generate_ack_id(sid, namespace, callback)
id = self._generate_ack_id(sid, namespace, callback)
else:
id = None
self.server._emit_internal(sid, event, data, namespace, id)

4
tests/test_base_manager.py

@ -220,9 +220,11 @@ class TestBaseManager(unittest.TestCase):
def test_emit_with_callback(self):
self.bm.connect('123', '/foo')
self.bm.server._generate_ack_id.return_value = 11
self.bm._generate_ack_id = mock.MagicMock()
self.bm._generate_ack_id.return_value = 11
self.bm.emit('my event', {'foo': 'bar'}, namespace='/foo',
callback='cb')
self.bm._generate_ack_id.assert_called_once_with('123', '/foo', 'cb')
self.bm.server._emit_internal.assert_called_once_with('123',
'my event',
{'foo': 'bar'},

Loading…
Cancel
Save