tests (unit/webrtc,XEP-0176, XEP-0234): Fix tests and add webrtc file transfer tests:
fix 441
This commit is contained in:
parent
e8fb0a8a28
commit
27b66b3fb2
1 changed files with 197 additions and 5 deletions
|
|
@ -162,11 +162,14 @@ class TestWebRtc:
|
|||
mock_pipeline.add.assert_called()
|
||||
mock_pad.link.assert_called()
|
||||
|
||||
@pytest.mark.skipif(Gst is None)
|
||||
@pytest.mark.skipif(Gst is None, reason="GStreamer is not available")
|
||||
@pytest.mark.asyncio
|
||||
async def test_setup_call_correct_role(self, host, webrtc, monkeypatch):
|
||||
"""Roles are set in setup_call."""
|
||||
monkeypatch.setattr(Gst, "parse_launch", MagicMock())
|
||||
# we use MagicMock class and not instance on purpose, to pass the "isinstance"
|
||||
# test of "setup_call".
|
||||
monkeypatch.setattr(Gst, "Pipeline", MagicMock)
|
||||
monkeypatch.setattr(data_format, "deserialise", MagicMock(return_value=[]))
|
||||
|
||||
await webrtc.setup_call("initiator")
|
||||
|
|
@ -196,13 +199,16 @@ class TestWebRtc:
|
|||
assert "v4l2src" in webrtc.gst_pipe_desc
|
||||
assert "pulsesrc" in webrtc.gst_pipe_desc
|
||||
|
||||
@pytest.mark.skipif(Gst is None)
|
||||
@pytest.mark.skipif(Gst is None, reason="GStreamer is not available")
|
||||
@pytest.mark.asyncio
|
||||
async def test_setup_call_with_stun_and_turn(self, host, webrtc, monkeypatch):
|
||||
"""STUN and TURN server configurations are done in setup_call."""
|
||||
mock_pipeline = MagicMock()
|
||||
mock_parse_launch = MagicMock()
|
||||
mock_parse_launch.return_value = mock_pipeline
|
||||
# As for "test_setup_call_correct_role" we user MagicMock class and not instance
|
||||
# on purpose here.
|
||||
monkeypatch.setattr(Gst, "Pipeline", MagicMock)
|
||||
monkeypatch.setattr(Gst, "parse_launch", mock_parse_launch)
|
||||
|
||||
mock_pipeline.get_by_name.return_value = webrtc.webrtcbin
|
||||
|
|
@ -237,7 +243,7 @@ class TestWebRtc:
|
|||
"add-turn-server", "turn://user:pass@turn.host:3478"
|
||||
)
|
||||
|
||||
@pytest.mark.skipif(Gst is None)
|
||||
@pytest.mark.skipif(Gst is None, reason="GStreamer is not available")
|
||||
@pytest.mark.asyncio
|
||||
async def test_setup_call_gstreamer_pipeline_failure(self, webrtc, monkeypatch):
|
||||
"""Test setup_call method handling Gstreamer pipeline failure."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue