Update Pubsub fixture and test

This commit is contained in:
NIC619
2019-11-26 16:12:50 +08:00
parent 0fd400fdf8
commit d5d6962dce
4 changed files with 39 additions and 7 deletions

View File

@ -510,3 +510,18 @@ async def test_push_msg(pubsubs_fsub, monkeypatch):
await pubsubs_fsub[0].push_msg(pubsubs_fsub[0].my_id, msg_2)
await asyncio.sleep(0.01)
assert not event.is_set()
@pytest.mark.parametrize("num_hosts, is_strict_signing", ((2, True),))
@pytest.mark.asyncio
async def test_strict_signing(pubsubs_fsub, hosts, monkeypatch):
await connect(hosts[0], hosts[1])
await pubsubs_fsub[0].subscribe(TESTING_TOPIC)
await pubsubs_fsub[1].subscribe(TESTING_TOPIC)
await asyncio.sleep(1)
await pubsubs_fsub[0].publish(TESTING_TOPIC, TESTING_DATA)
await asyncio.sleep(1)
assert len(pubsubs_fsub[0].seen_messages) == 1
assert len(pubsubs_fsub[1].seen_messages) == 1