tests (unit): fix tests + black reformatting.

This commit is contained in:
Goffi 2024-07-14 17:42:53 +02:00
commit 067d8f32bf

View file

@ -29,7 +29,6 @@ from libervia.backend.tools.common import data_format
from libervia.frontends.tools import webrtc as webrtc_mod
@pytest.fixture
def host(monkeypatch):
host = MagicMock()
@ -37,6 +36,7 @@ def host(monkeypatch):
host.app.expand = lambda s: s
return host
@pytest.fixture(scope="function")
def webrtc(host):
"""Fixture for WebRTC instantiation."""
@ -185,7 +185,7 @@ class TestWebRtc:
async def test_setup_call_test_mode(self, host, webrtc, monkeypatch):
"""Test mode use fake video and audio in setup_call."""
monkeypatch.setattr(data_format, "deserialise", MagicMock(return_value=[]))
monkeypatch.setattr(webrtc, "sources", webrtc_mod.SINKS_TEST)
monkeypatch.setattr(webrtc, "sources_data", webrtc_mod.SourcesTest())
await webrtc.setup_call("initiator")
assert "videotestsrc" in webrtc.gst_pipe_desc
assert "audiotestsrc" in webrtc.gst_pipe_desc
@ -194,7 +194,7 @@ class TestWebRtc:
async def test_setup_call_normal_mode(self, host, webrtc, monkeypatch):
"""Normal mode use real video and audio in setup_call."""
monkeypatch.setattr(data_format, "deserialise", MagicMock(return_value=[]))
monkeypatch.setattr(webrtc, "sources", webrtc_mod.SOURCES_AUTO)
monkeypatch.setattr(webrtc, "sources_data", webrtc_mod.SourcesAuto())
await webrtc.setup_call("initiator")
assert "v4l2src" in webrtc.gst_pipe_desc
assert "pulsesrc" in webrtc.gst_pipe_desc