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'},