From 01600a8e79c388037099a099ea942168219eacb3 Mon Sep 17 00:00:00 2001 From: Fabien Danieau Date: Wed, 7 Aug 2024 16:01:08 +0200 Subject: [PATCH] enhancement #46: add producer test --- setup.cfg | 1 + tests/test_list_producers.py | 4 ++++ tests/test_producer.py | 16 ++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/test_producer.py diff --git a/setup.cfg b/setup.cfg index a66fde8..97f0548 100644 --- a/setup.cfg +++ b/setup.cfg @@ -31,6 +31,7 @@ dev = black==23.10.1 isort==5.12.0 pygobject-stubs==2.10.0 pytest==7.4.3 + pytest-asyncio==0.23.8 coverage==7.3.2 [options.entry_points] diff --git a/tests/test_list_producers.py b/tests/test_list_producers.py index 64ec2c3..27afb1a 100644 --- a/tests/test_list_producers.py +++ b/tests/test_list_producers.py @@ -7,3 +7,7 @@ def test_empty_list(signalling_host: str, signalling_port: int) -> None: producers = utils.get_producer_list(signalling_host, signalling_port) assert len(producers) == 0 + + +# @pytest.mark.asyncio +# async def test_some_asyncio_code(signalling_host: str, signalling_port: int) -> None: diff --git a/tests/test_producer.py b/tests/test_producer.py new file mode 100644 index 0000000..9803c84 --- /dev/null +++ b/tests/test_producer.py @@ -0,0 +1,16 @@ +import pytest + +from gst_signalling import GstSignallingProducer + + +@pytest.mark.asyncio +async def test_simple_producer(signalling_host: str, signalling_port: int) -> None: + producer = GstSignallingProducer( + host=signalling_host, + port=signalling_port, + name="pytest producer", + ) + + await producer.connect() + assert len(producer.peer_id) == 36 + await producer.close()