async def test_network_id_ipc_request(jsonrpc_ipc_pipe_path, event_loop, event_bus, ipc_server): do_mock = mock_request_response(NetworkIdRequest, NetworkIdResponse(1337), event_bus) async with do_mock: request_msg = build_request('net_version') expected = {'result': '1337', 'id': 3, 'jsonrpc': '2.0'} result = await get_ipc_response(jsonrpc_ipc_pipe_path, request_msg, event_loop, event_bus) assert result == expected
async def mock_event_bus_interaction(bus): async for req in bus.stream(NetworkIdRequest): bus.broadcast(NetworkIdResponse(network_id), req.broadcast_config()) break