mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-28 03:08:14 +00:00
Fix server close tests
This commit is contained in:
parent
5c3969ae79
commit
571044b3e8
@ -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))
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user