Support read/write of noise msg and payload

This commit is contained in:
mhchia
2020-02-15 12:12:12 +08:00
parent 1f881e0464
commit 8a4ebd4cbb
5 changed files with 158 additions and 33 deletions

View File

@ -0,0 +1,20 @@
import pytest
from libp2p.tools.factories import noise_conn_factory
DATA = b"testing_123"
@pytest.mark.trio
async def test_noise_transport(nursery):
async with noise_conn_factory(nursery):
pass
@pytest.mark.trio
async def test_noise_connection(nursery):
async with noise_conn_factory(nursery) as conns:
local_conn, remote_conn = conns
await local_conn.write(DATA)
read_data = await remote_conn.read(len(DATA))
assert read_data == DATA