tests: fix and update tests:

- update code to newer version of `sh`
- update code to newer version of `selenium`
- update names of OMEMO algorithms
- fix paths and names used to mount source to the test container
- skip modules using `Gst` and `PyQt` when they are not available.
This commit is contained in:
Goffi 2024-03-05 17:31:56 +01:00
commit 48201780de
2 changed files with 58 additions and 29 deletions

View file

@ -17,11 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from unittest.mock import MagicMock, patch
from PyQt6.QtWidgets import QApplication
import pytest
from libervia.cli.call_gui import AVCallUI
from libervia.frontends.tools import display_servers
try:
from libervia.cli.call_gui import AVCallUI
from libervia.frontends.tools import display_servers
from PyQt6.QtWidgets import QApplication
except ModuleNotFoundError:
pytest.skip("PyQt6 is not available.", allow_module_level=True)
@pytest.fixture(scope="session")

View file

@ -17,9 +17,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from unittest.mock import AsyncMock, MagicMock
from gi.repository import Gst
import pytest
try:
from gi.repository import Gst
except ImportError:
pytest.skip("Gst not available.", allow_module_level=True)
from libervia.backend.core import exceptions
from libervia.backend.tools.common import data_format
from libervia.frontends.tools import webrtc as webrtc_mod
@ -158,6 +162,7 @@ class TestWebRtc:
mock_pipeline.add.assert_called()
mock_pad.link.assert_called()
@pytest.mark.skipif(Gst is None)
@pytest.mark.asyncio
async def test_setup_call_correct_role(self, host, webrtc, monkeypatch):
"""Roles are set in setup_call."""
@ -191,6 +196,7 @@ class TestWebRtc:
assert "v4l2src" in webrtc.gst_pipe_desc
assert "pulsesrc" in webrtc.gst_pipe_desc
@pytest.mark.skipif(Gst is None)
@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."""
@ -231,6 +237,7 @@ class TestWebRtc:
"add-turn-server", "turn://user:pass@turn.host:3478"
)
@pytest.mark.skipif(Gst is None)
@pytest.mark.asyncio
async def test_setup_call_gstreamer_pipeline_failure(self, webrtc, monkeypatch):
"""Test setup_call method handling Gstreamer pipeline failure."""