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