From 07eab6e766ece3cb919dd78511eed3b7b38eb957 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Thu, 11 Jun 2015 09:18:02 +0200 Subject: [PATCH] Fix tests --- tests/conftest.py | 1 + tests/handlers/test_upload.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 74aee0cb..68d8a1af 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -136,6 +136,7 @@ def run_around_tests(monkeypatch): config = Config.instance() config.clear() config.set("Server", "project_directory", tmppath) + config.set("Server", "auth", False) # Prevent exectuions of the VM if we forgot to mock something config.set("VirtualBox", "vboxmanage_path", tmppath) diff --git a/tests/handlers/test_upload.py b/tests/handlers/test_upload.py index 63d60ef8..64fdab73 100644 --- a/tests/handlers/test_upload.py +++ b/tests/handlers/test_upload.py @@ -19,7 +19,7 @@ import aiohttp import os from unittest.mock import patch - +from gns3server.config import Config def test_index_upload(server): response = server.get('/upload', api_version=None) @@ -37,8 +37,8 @@ def test_upload(server, tmpdir): body.add_field("type", "QEMU") body.add_field("file", open(str(tmpdir / "test"), "rb"), content_type="application/iou", filename="test2") - with patch("gns3server.config.Config.get_section_config", return_value={"images_path": str(tmpdir)}): - response = server.post('/upload', api_version=None, body=body, raw=True) + Config.instance().set("Server", "images_path", str(tmpdir)) + response = server.post('/upload', api_version=None, body=body, raw=True) with open(str(tmpdir / "QEMU" / "test2")) as f: assert f.read() == "TEST"