From 4a4ba41d0c7c6c5547fc73065ab2279ca7fce76b Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Mon, 21 Sep 2015 22:43:07 -0700 Subject: [PATCH] fixed regression introduced in latest release with ack ids --- socketio/base_manager.py | 2 +- tests/test_base_manager.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/socketio/base_manager.py b/socketio/base_manager.py index c8e6ff3..7d13f1f 100644 --- a/socketio/base_manager.py +++ b/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) diff --git a/tests/test_base_manager.py b/tests/test_base_manager.py index 9790777..1cdfa6b 100644 --- a/tests/test_base_manager.py +++ b/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'},