MCPcopy Index your code
hub / github.com/miguelgrinberg/python-socketio / test_call

Method test_call

tests/async/test_client.py:475–493  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

473 )
474
475 async def test_call(self):
476 c = async_client.AsyncClient()
477 c.namespaces = {'/': '1'}
478
479 async def fake_event_wait():
480 c._generate_ack_id.call_args_list[0][0][1]('foo', 321)
481
482 c._send_packet = mock.AsyncMock()
483 c._generate_ack_id = mock.MagicMock(return_value=123)
484 c.eio = mock.MagicMock()
485 c.eio.create_event.return_value.wait = fake_event_wait
486 assert await c.call('foo') == ('foo', 321)
487 expected_packet = packet.Packet(
488 packet.EVENT, namespace='/', data=['foo'], id=123)
489 assert c._send_packet.await_count == 1
490 assert (
491 c._send_packet.await_args_list[0][0][0].encode()
492 == expected_packet.encode()
493 )
494
495 async def test_call_with_timeout(self):
496 c = async_client.AsyncClient()

Callers

nothing calls this directly

Calls 2

callMethod · 0.95
encodeMethod · 0.95

Tested by

no test coverage detected