diff --git a/tests/handlers/api/test_docker.py b/tests/handlers/api/test_docker.py index 06d58026..beaab7bd 100644 --- a/tests/handlers/api/test_docker.py +++ b/tests/handlers/api/test_docker.py @@ -24,6 +24,7 @@ import aiohttp from tests.utils import asyncio_patch from unittest.mock import patch, MagicMock, PropertyMock +from gns3server.modules.docker import Docker @pytest.fixture @@ -32,6 +33,15 @@ def base_params(): return {"name": "PC TEST 1", "image": "nginx", "start_command": "nginx-daemon", "adapters": 2, "environment": "YES=1\nNO=0"} +@pytest.yield_fixture(autouse=True) +def mock_connection(): + docker = Docker.instance() + docker._connected = True + docker._connector = MagicMock() + yield + Docker._instance = None + + @pytest.fixture def vm(server, project, base_params): with asyncio_patch("gns3server.modules.docker.Docker.list_images", return_value=[{"image": "nginx"}]) as mock_list: