From 978ec1b5be8c88d4b013bcc83db58676d8cd746f Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 2 May 2016 17:06:51 +0200 Subject: [PATCH] Fix test --- tests/modules/docker/test_docker.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/modules/docker/test_docker.py b/tests/modules/docker/test_docker.py index fa6f1a7d..fb03f466 100644 --- a/tests/modules/docker/test_docker.py +++ b/tests/modules/docker/test_docker.py @@ -24,11 +24,17 @@ from gns3server.modules.docker import Docker from gns3server.modules.docker.docker_error import DockerError -def test_query_success(loop): - +@pytest.fixture +def vm(): vm = Docker() - vm._connector = MagicMock() vm._connected = True + vm._connector = MagicMock() + vm._connector.closed = False + return vm + + +def test_query_success(loop, vm): + response = MagicMock() response.status = 200 response.headers = {'CONTENT-TYPE': 'application/json'} @@ -50,11 +56,8 @@ def test_query_success(loop): assert data == {"c": False} -def test_query_error(loop): +def test_query_error(loop, vm): - vm = Docker() - vm._connected = True - vm._connector = MagicMock() response = MagicMock() response.status = 404 @@ -74,11 +77,8 @@ def test_query_error(loop): params={'b': 1}) -def test_query_error_json(loop): +def test_query_error_json(loop, vm): - vm = Docker() - vm._connected = True - vm._connector = MagicMock() response = MagicMock() response.status = 404