|
|
@ -137,11 +137,25 @@ def test_iou_get(server, project, vm):
|
|
|
|
|
|
|
|
|
|
|
|
def test_iou_start(server, vm):
|
|
|
|
def test_iou_start(server, vm):
|
|
|
|
with asyncio_patch("gns3server.modules.iou.iou_vm.IOUVM.start", return_value=True) as mock:
|
|
|
|
with asyncio_patch("gns3server.modules.iou.iou_vm.IOUVM.start", return_value=True) as mock:
|
|
|
|
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/start".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), example=True)
|
|
|
|
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/start".format(project_id=vm["project_id"], vm_id=vm["vm_id"]))
|
|
|
|
assert mock.called
|
|
|
|
assert mock.called
|
|
|
|
assert response.status == 204
|
|
|
|
assert response.status == 204
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_iou_start_with_iourc(server, vm, tmpdir):
|
|
|
|
|
|
|
|
body = {"iourc_content": "test"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with asyncio_patch("gns3server.modules.iou.iou_vm.IOUVM.start", return_value=True) as mock:
|
|
|
|
|
|
|
|
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/start".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), body=body, example=True)
|
|
|
|
|
|
|
|
assert mock.called
|
|
|
|
|
|
|
|
assert response.status == 204
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response = server.get("/projects/{project_id}/iou/vms/{vm_id}".format(project_id=vm["project_id"], vm_id=vm["vm_id"]))
|
|
|
|
|
|
|
|
assert response.status == 200
|
|
|
|
|
|
|
|
with open(response.json["iourc_path"]) as f:
|
|
|
|
|
|
|
|
assert f.read() == "test"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_iou_stop(server, vm):
|
|
|
|
def test_iou_stop(server, vm):
|
|
|
|
with asyncio_patch("gns3server.modules.iou.iou_vm.IOUVM.stop", return_value=True) as mock:
|
|
|
|
with asyncio_patch("gns3server.modules.iou.iou_vm.IOUVM.stop", return_value=True) as mock:
|
|
|
|
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/stop".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), example=True)
|
|
|
|
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/stop".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), example=True)
|
|
|
|