2019-09-18 15:44:45 +08:00
|
|
|
import pytest
|
|
|
|
|
2019-11-21 11:47:54 +08:00
|
|
|
from libp2p.tools.factories import mplex_conn_pair_factory, mplex_stream_pair_factory
|
2019-09-18 15:44:45 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
async def mplex_conn_pair(is_host_secure):
|
2019-11-26 19:24:30 +08:00
|
|
|
async with mplex_conn_pair_factory(is_host_secure) as mplex_conn_pair:
|
|
|
|
assert mplex_conn_pair[0].is_initiator
|
|
|
|
assert not mplex_conn_pair[1].is_initiator
|
|
|
|
yield mplex_conn_pair[0], mplex_conn_pair[1]
|
2019-09-18 21:51:09 +08:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture
|
|
|
|
async def mplex_stream_pair(is_host_secure):
|
2019-11-26 19:24:30 +08:00
|
|
|
async with mplex_stream_pair_factory(is_host_secure) as mplex_stream_pair:
|
|
|
|
yield mplex_stream_pair
|