Allow to send the iourc when starting the VM

Ref https://github.com/GNS3/gns3-server/issues/255
This commit is contained in:
Julien Duponchelle committed 2015-07-09 16:06:52 +02:00
1 parent dd6c377b15
commit a461cb71c6
3 files changed
+40 -3

No files matched your search

+15 -1
View File
@@ -137,11 +137,25 @@ def test_iou_get(server, project, vm):
def test_iou_start(server, vm):
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 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):
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)