Merge branch 'master' into 1.5

This commit is contained in:
Julien Duponchelle committed 2016-02-08 13:14:30 +01:00
commit f6fb0623be
29 files changed
+167 -85

No files matched your search

+4 -4
View File
@@ -61,20 +61,20 @@ class Query:
body = json.dumps(body)
@asyncio.coroutine
def go(future):
def go_request(future):
response = yield from aiohttp.request(method, self.get_url(path, api_version), data=body)
future.set_result(response)
future = asyncio.Future()
asyncio.async(go(future))
asyncio.async(go_request(future))
self._loop.run_until_complete(future)
response = future.result()
@asyncio.coroutine
def go(future, response):
def go_read(future, response):
response = yield from response.read()
future.set_result(response)
future = asyncio.Future()
asyncio.async(go(future, response))
asyncio.async(go_read(future, response))
self._loop.run_until_complete(future)
response.body = future.result()
x_route = response.headers.get('X-Route', None)
+3 -2
View File
@@ -139,7 +139,8 @@ 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"]))
assert mock.called
assert response.status == 204
assert response.status == 200
assert response.json["name"] == "PC TEST 1"
def test_iou_start_with_iourc(server, vm, tmpdir):
@@ -148,7 +149,7 @@ def test_iou_start_with_iourc(server, vm, tmpdir):
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
assert response.status == 200
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
+2 -1
View File
@@ -114,7 +114,8 @@ def test_qemu_start(server, vm):
with asyncio_patch("gns3server.modules.qemu.qemu_vm.QemuVM.start", return_value=True) as mock:
response = server.post("/projects/{project_id}/qemu/vms/{vm_id}/start".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), example=True)
assert mock.called
assert response.status == 204
assert response.status == 200
assert response.json["name"] == "PC TEST 1"
def test_qemu_stop(server, vm):
+2 -1
View File
@@ -102,7 +102,8 @@ def test_vpcs_start(server, vm):
with asyncio_patch("gns3server.modules.vpcs.vpcs_vm.VPCSVM.start", return_value=True) as mock:
response = server.post("/projects/{project_id}/vpcs/vms/{vm_id}/start".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), example=True)
assert mock.called
assert response.status == 204
assert response.status == 200
assert response.json["name"] == "PC TEST 1"
def test_vpcs_stop(server, vm):