Fix a crash in Travis tests

Fix #422
This commit is contained in:
Julien Duponchelle 2016-02-10 17:10:52 +01:00
parent a7ec224b6d
commit 5a8408cdb9
No known key found for this signature in database
GPG Key ID: F1E2485547D4595D

View File

@ -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: