mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 07:23:47 +02:00
Fix dynamips tests
This commit is contained in:
parent
c05edfe415
commit
e54649accd
@ -133,6 +133,7 @@ def run_around_tests(monkeypatch):
|
|||||||
|
|
||||||
tmppath = tempfile.mkdtemp()
|
tmppath = tempfile.mkdtemp()
|
||||||
|
|
||||||
|
Config.reset()
|
||||||
config = Config.instance()
|
config = Config.instance()
|
||||||
server_section = config.get_section_config("Server")
|
server_section = config.get_section_config("Server")
|
||||||
server_section["project_directory"] = tmppath
|
server_section["project_directory"] = tmppath
|
||||||
|
@ -23,6 +23,7 @@ from unittest.mock import patch
|
|||||||
from gns3server.modules.dynamips.nodes.router import Router
|
from gns3server.modules.dynamips.nodes.router import Router
|
||||||
from gns3server.modules.dynamips.dynamips_error import DynamipsError
|
from gns3server.modules.dynamips.dynamips_error import DynamipsError
|
||||||
from gns3server.modules.dynamips import Dynamips
|
from gns3server.modules.dynamips import Dynamips
|
||||||
|
from gns3server.config import Config
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="module")
|
@pytest.fixture(scope="module")
|
||||||
@ -44,7 +45,13 @@ def test_router(project, manager):
|
|||||||
|
|
||||||
|
|
||||||
def test_router_invalid_dynamips_path(project, manager, loop):
|
def test_router_invalid_dynamips_path(project, manager, loop):
|
||||||
with patch("gns3server.config.Config.get_section_config", return_value={"dynamips_path": "/bin/test_fake"}):
|
|
||||||
|
config = Config.instance()
|
||||||
|
dynamips_section = config.get_section_config("Dynamips")
|
||||||
|
dynamips_section["dynamips_path"] = "/bin/test_fake"
|
||||||
|
dynamips_section["allocate_aux_console_ports"] = "false"
|
||||||
|
config.set_section_config("Dynamips", dynamips_section)
|
||||||
|
|
||||||
with pytest.raises(DynamipsError):
|
with pytest.raises(DynamipsError):
|
||||||
router = Router("test", "00010203-0405-0607-0809-0a0b0c0d0e0e", project, manager)
|
router = Router("test", "00010203-0405-0607-0809-0a0b0c0d0e0e", project, manager)
|
||||||
loop.run_until_complete(asyncio.async(router.create()))
|
loop.run_until_complete(asyncio.async(router.create()))
|
||||||
|
Loading…
Reference in New Issue
Block a user