diff --git a/gns3server/modules/virtualbox/virtualbox_vm.py b/gns3server/modules/virtualbox/virtualbox_vm.py index 924dbfb2..49ad1cc2 100644 --- a/gns3server/modules/virtualbox/virtualbox_vm.py +++ b/gns3server/modules/virtualbox/virtualbox_vm.py @@ -500,7 +500,7 @@ class VirtualBoxVM(BaseVM): self._adapter_start_index = adapter_start_index # TODO: get rid of adapter start index - #self.adapters = self.adapters # this forces to recreate the adapter list with the correct index + # self.adapters = self.adapters # this forces to recreate the adapter list with the correct index log.info("VirtualBox VM '{name}' [{id}]: adapter start index changed to {index}".format(name=self.name, id=self.id, index=adapter_start_index)) diff --git a/tests/modules/test_project.py b/tests/modules/test_project.py index f1d5775f..b2ce3466 100644 --- a/tests/modules/test_project.py +++ b/tests/modules/test_project.py @@ -24,6 +24,7 @@ import shutil from uuid import uuid4 from unittest.mock import patch +from tests.utils import asyncio_patch from gns3server.modules.project import Project from gns3server.modules.vpcs import VPCS, VPCSVM @@ -183,7 +184,7 @@ def test_project_close(loop, manager): project = Project() vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager) project.add_vm(vm) - with patch("gns3server.modules.vpcs.vpcs_vm.VPCSVM.close") as mock: + with asyncio_patch("gns3server.modules.vpcs.vpcs_vm.VPCSVM.close") as mock: loop.run_until_complete(asyncio.async(project.close())) assert mock.called diff --git a/tests/utils.py b/tests/utils.py index bc8dc5dc..b8994f66 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -48,7 +48,10 @@ class _asyncio_patch: def _fake_anwser(self): future = asyncio.Future() - future.set_result(self.kwargs["return_value"]) + if "return_value" in self.kwargs: + future.set_result(self.kwargs["return_value"]) + else: + future.set_result(True) return future