mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-25 16:28:11 +00:00
Merge branch 'master' into unstable
This commit is contained in:
commit
04e62e429c
@ -90,6 +90,9 @@ class Route(object):
|
|||||||
|
|
||||||
:returns: Response if you need to auth the user otherwise None
|
:returns: Response if you need to auth the user otherwise None
|
||||||
"""
|
"""
|
||||||
|
if not server_config.getboolean("auth", False):
|
||||||
|
return
|
||||||
|
|
||||||
user = server_config.get("user", "").strip()
|
user = server_config.get("user", "").strip()
|
||||||
password = server_config.get("password", "").strip()
|
password = server_config.get("password", "").strip()
|
||||||
|
|
||||||
|
@ -145,6 +145,7 @@ def run_around_tests(monkeypatch):
|
|||||||
config = Config.instance()
|
config = Config.instance()
|
||||||
config.clear()
|
config.clear()
|
||||||
config.set("Server", "project_directory", tmppath)
|
config.set("Server", "project_directory", tmppath)
|
||||||
|
config.set("Server", "auth", False)
|
||||||
|
|
||||||
# Prevent exectuions of the VM if we forgot to mock something
|
# Prevent exectuions of the VM if we forgot to mock something
|
||||||
config.set("VirtualBox", "vboxmanage_path", tmppath)
|
config.set("VirtualBox", "vboxmanage_path", tmppath)
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
import aiohttp
|
import aiohttp
|
||||||
import os
|
import os
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
from gns3server.config import Config
|
||||||
|
|
||||||
def test_index_upload(server):
|
def test_index_upload(server):
|
||||||
response = server.get('/upload', api_version=None)
|
response = server.get('/upload', api_version=None)
|
||||||
@ -39,8 +39,8 @@ def test_upload(server, tmpdir):
|
|||||||
body.add_field("type", "QEMU")
|
body.add_field("type", "QEMU")
|
||||||
body.add_field("file", open(str(tmpdir / "test"), "rb"), content_type="application/iou", filename="test2")
|
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)}):
|
Config.instance().set("Server", "images_path", str(tmpdir))
|
||||||
response = server.post('/upload', api_version=None, body=body, raw=True)
|
response = server.post('/upload', api_version=None, body=body, raw=True)
|
||||||
|
|
||||||
with open(str(tmpdir / "QEMU" / "test2")) as f:
|
with open(str(tmpdir / "QEMU" / "test2")) as f:
|
||||||
assert f.read() == content
|
assert f.read() == content
|
||||||
|
Loading…
Reference in New Issue
Block a user