mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-18 02:39:45 +00:00
Fix server close tests
This commit is contained in:
parent
5c3969ae79
commit
571044b3e8
@ -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()
|
||||
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