1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-29 02:08:10 +00:00

Fix IOU old project import

Fixes #69
This commit is contained in:
Julien Duponchelle 2015-02-25 16:35:13 +01:00
parent 818676ce5e
commit 8434a286b6
2 changed files with 15 additions and 1 deletions

View File

@ -62,3 +62,13 @@ class IOU(BaseManager):
"""
return self._used_application_ids.get(vm_id, 1)
def get_legacy_vm_workdir_name(legacy_vm_id):
"""
Returns the name of the legacy working directory (pre 1.3) name for a VM.
:param legacy_vm_id: legacy VM identifier (integer)
:returns: working directory name
"""
return "device-{}".format(legacy_vm_id)

View File

@ -175,7 +175,6 @@ def test_path(vm, fake_iou_bin):
assert vm.path == fake_iou_bin
def test_path_relative(vm, fake_iou_bin, tmpdir):
with patch("gns3server.config.Config.get_section_config", return_value={"images_path": str(tmpdir)}):
@ -302,3 +301,8 @@ def test_stop_capture(vm, tmpdir, manager, free_console_port, loop):
assert vm._adapters[0].get_nio(0).capturing
loop.run_until_complete(asyncio.async(vm.stop_capture(0, 0)))
assert vm._adapters[0].get_nio(0).capturing is False
def test_get_legacy_vm_workdir_name():
assert IOU.get_legacy_vm_workdir_name(42) == "device-42"