From c1d351e930d20a1408d9eaaa1c3e8fe599e28d28 Mon Sep 17 00:00:00 2001 From: Fabien Danieau Date: Wed, 7 Aug 2024 12:20:56 +0200 Subject: [PATCH] enhancement #46: test receiving list of producers --- .github/workflows/unit_tests.yml | 8 +++++--- setup.cfg | 2 ++ tests/conftest.py | 11 +++++++++++ tests/test_list_producers.py | 9 +++++++++ 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 tests/conftest.py create mode 100644 tests/test_list_producers.py diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index a863fbd..586d8fd 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -14,13 +14,15 @@ jobs: - name : Install Rust uses: hecrj/setup-rust-action@v2 - - name: Clone gst-plugins-rs + - name: Install Gst Signalling Server run: | git clone -b 0.12.8 --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git cd gst-plugins-rs/net/webrtc/signalling/ cargo build - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: @@ -29,4 +31,4 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install . + pip install .[dev] diff --git a/setup.cfg b/setup.cfg index cc41826..a66fde8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -30,6 +30,8 @@ dev = black==23.10.1 mypy==1.6.1 isort==5.12.0 pygobject-stubs==2.10.0 + pytest==7.4.3 + coverage==7.3.2 [options.entry_points] console_scripts = diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..8866b9e --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,11 @@ +import pytest + + +@pytest.fixture +def signalling_host() -> str: + return "127.0.0.1" + + +@pytest.fixture +def signalling_port() -> int: + return 8443 diff --git a/tests/test_list_producers.py b/tests/test_list_producers.py new file mode 100644 index 0000000..64ec2c3 --- /dev/null +++ b/tests/test_list_producers.py @@ -0,0 +1,9 @@ +import pytest + +from gst_signalling import utils + + +def test_empty_list(signalling_host: str, signalling_port: int) -> None: + producers = utils.get_producer_list(signalling_host, signalling_port) + + assert len(producers) == 0