From 1f116fc992aecfe95329f6e514fe7804c8d45be1 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Fri, 3 Jul 2015 10:43:48 +0200 Subject: [PATCH] Fix tests --- tests/handlers/api/test_dynamips.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/handlers/api/test_dynamips.py b/tests/handlers/api/test_dynamips.py index 4fb5b704..0fb21c88 100644 --- a/tests/handlers/api/test_dynamips.py +++ b/tests/handlers/api/test_dynamips.py @@ -131,16 +131,26 @@ from tests.utils import asyncio_patch @pytest.fixture def fake_dynamips(tmpdir): - """Create a fake IOU image on disk""" + """Create a fake Dynamips image on disk""" path = str(tmpdir / "7200.bin") + with open(path, "wb+") as f: + f.write(b'\x7fELF\x01\x02\x01') + os.chmod(path, stat.S_IREAD) + return path + + +@pytest.fixture +def fake_file(tmpdir): + """Create a fake file disk""" + + path = str(tmpdir / "7200.txt") with open(path, "w+") as f: f.write('1') os.chmod(path, stat.S_IREAD) return path - -def test_vms(server, tmpdir, fake_dynamips): +def test_vms(server, tmpdir, fake_dynamips, fake_file): with patch("gns3server.modules.Dynamips.get_images_directory", return_value=str(tmpdir), example=True): response = server.get("/dynamips/vms")