mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-06 07:11:13 +02:00
Fix tests.
This commit is contained in:
1 parent
9c850e0f2b
commit
6b8ce8219c
5 files changed
+15
-18
No files matched your search
@@ -75,14 +75,13 @@ async def test_vbox_get(app: FastAPI, client: AsyncClient, compute_project: Proj
|
||||
|
||||
async def test_vbox_start(app: FastAPI, client: AsyncClient, vm: dict) -> None:
|
||||
|
||||
with asyncio_patch("gns3server.compute.virtualbox.virtualbox_vm.VirtualBoxVM.check_hw_virtualization", return_value=True):
|
||||
with asyncio_patch("gns3server.compute.virtualbox.virtualbox_vm.VirtualBoxVM.start", return_value=True) as mock:
|
||||
with asyncio_patch("gns3server.compute.virtualbox.virtualbox_vm.VirtualBoxVM.start", return_value=True) as mock:
|
||||
|
||||
response = await client.post(app.url_path_for("start_virtualbox_node",
|
||||
project_id=vm["project_id"],
|
||||
node_id=vm["node_id"]))
|
||||
assert mock.called
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
response = await client.post(app.url_path_for("start_virtualbox_node",
|
||||
project_id=vm["project_id"],
|
||||
node_id=vm["node_id"]))
|
||||
assert mock.called
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
|
||||
|
||||
async def test_vbox_stop(app: FastAPI, client: AsyncClient, vm: dict) -> None:
|
||||
|
||||
@@ -82,14 +82,12 @@ async def test_vmware_get(app: FastAPI, client: AsyncClient, compute_project: Pr
|
||||
|
||||
async def test_vmware_start(app: FastAPI, client: AsyncClient, vm: dict) -> None:
|
||||
|
||||
with asyncio_patch("gns3server.compute.vmware.vmware_vm.VMwareVM.check_hw_virtualization", return_value=True) as mock1:
|
||||
with asyncio_patch("gns3server.compute.vmware.vmware_vm.VMwareVM.start", return_value=True) as mock2:
|
||||
response = await client.post(app.url_path_for("start_vmware_node",
|
||||
project_id=vm["project_id"],
|
||||
node_id=vm["node_id"]))
|
||||
assert mock1.called
|
||||
assert mock2.called
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
with asyncio_patch("gns3server.compute.vmware.vmware_vm.VMwareVM.start", return_value=True) as mock:
|
||||
response = await client.post(app.url_path_for("start_vmware_node",
|
||||
project_id=vm["project_id"],
|
||||
node_id=vm["node_id"]))
|
||||
assert mock.called
|
||||
assert response.status_code == status.HTTP_204_NO_CONTENT
|
||||
|
||||
|
||||
async def test_vmware_stop(app: FastAPI, client: AsyncClient, vm: dict) -> None:
|
||||
|
||||
Reference in new issue
Block a user