nomos-specs/mixnet/test_mixnet.py

21 lines
655 B
Python
Raw Normal View History

import asyncio
2024-02-05 06:47:36 +00:00
from unittest import IsolatedAsyncioTestCase
from mixnet.mixnet import Mixnet
from mixnet.test_utils import init_mixnet_config
2024-02-05 06:47:36 +00:00
class TestMixnet(IsolatedAsyncioTestCase):
async def test_topology_from_robustness(self):
config = init_mixnet_config()
entropy_queue = asyncio.Queue()
2024-02-05 06:47:36 +00:00
mixnet = await Mixnet.new(config, entropy_queue)
try:
old_topology = config.mixclient_config.topology
await entropy_queue.put(b"new entropy")
await asyncio.sleep(1)
self.assertNotEqual(old_topology, mixnet.get_topology())
finally:
await mixnet.cancel()