|
|
@ -10,7 +10,7 @@ if six.PY3: |
|
|
|
else: |
|
|
|
import mock |
|
|
|
|
|
|
|
from socketio import asyncio_server, exceptions |
|
|
|
from socketio import asyncio_server |
|
|
|
from socketio import asyncio_namespace |
|
|
|
from socketio import exceptions |
|
|
|
from socketio import namespace |
|
|
@ -134,7 +134,7 @@ class TestAsyncServer(unittest.TestCase): |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, |
|
|
|
async_handlers=False) |
|
|
|
self.assertRaises(RuntimeError, _run, |
|
|
|
s.call('foo', sid='123', timeout=12)) |
|
|
|
s.call('foo', sid='123', timeout=12)) |
|
|
|
|
|
|
|
def test_enter_room(self, eio): |
|
|
|
mgr = self._get_mock_manager() |
|
|
@ -448,7 +448,8 @@ class TestAsyncServer(unittest.TestCase): |
|
|
|
def test_handle_event_binary_ack(self, eio): |
|
|
|
eio.return_value.send = AsyncMock() |
|
|
|
mgr = self._get_mock_manager() |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, async_handlers=False) |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, |
|
|
|
async_handlers=False) |
|
|
|
s.manager.initialize(s) |
|
|
|
_run(s._handle_eio_message('123', '61-321["my message","a",' |
|
|
|
'{"_placeholder":true,"num":0}]')) |
|
|
@ -479,7 +480,8 @@ class TestAsyncServer(unittest.TestCase): |
|
|
|
def test_handle_event_with_ack_tuple(self, eio): |
|
|
|
eio.return_value.send = AsyncMock() |
|
|
|
mgr = self._get_mock_manager() |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, async_handlers=False) |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, |
|
|
|
async_handlers=False) |
|
|
|
handler = mock.MagicMock(return_value=(1, '2', True)) |
|
|
|
s.on('my message', handler) |
|
|
|
_run(s._handle_eio_message('123', '21000["my message","a","b","c"]')) |
|
|
@ -490,7 +492,8 @@ class TestAsyncServer(unittest.TestCase): |
|
|
|
def test_handle_event_with_ack_list(self, eio): |
|
|
|
eio.return_value.send = AsyncMock() |
|
|
|
mgr = self._get_mock_manager() |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, async_handlers=False) |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, |
|
|
|
async_handlers=False) |
|
|
|
handler = mock.MagicMock(return_value=[1, '2', True]) |
|
|
|
s.on('my message', handler) |
|
|
|
_run(s._handle_eio_message('123', '21000["my message","a","b","c"]')) |
|
|
@ -501,7 +504,8 @@ class TestAsyncServer(unittest.TestCase): |
|
|
|
def test_handle_event_with_ack_binary(self, eio): |
|
|
|
eio.return_value.send = AsyncMock() |
|
|
|
mgr = self._get_mock_manager() |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, async_handlers=False) |
|
|
|
s = asyncio_server.AsyncServer(client_manager=mgr, |
|
|
|
async_handlers=False) |
|
|
|
handler = mock.MagicMock(return_value=b'foo') |
|
|
|
s.on('my message', handler) |
|
|
|
_run(s._handle_eio_message('123', '21000["my message","foo"]')) |
|
|
|