VPCS reload

This commit is contained in:
Julien Duponchelle committed 2015-01-22 10:55:11 +01:00
1 parent 1a43ff118c
commit 8d3ea60404
18 files changed
+69 -22

No files matched your search

+7
View File
@@ -119,6 +119,13 @@ def test_vpcs_stop(server, vm):
assert response.status == 204
def test_vpcs_reload(server, vm):
with asyncio_patch("gns3server.modules.vpcs.vpcs_vm.VPCSVM.reload", return_value=True) as mock:
response = server.post("/vpcs/{}/reload".format(vm["uuid"]))
assert mock.called
assert response.status == 204
def test_vpcs_update(server, vm, tmpdir, free_console_port):
path = os.path.join(str(tmpdir), 'startup2.vpcs')
with open(path, 'w+') as f:
+13
View File
@@ -87,6 +87,19 @@ def test_stop(loop, vm):
process.terminate.assert_called_with()
def test_reload(loop, vm):
process = MagicMock()
with asyncio_patch("gns3server.modules.vpcs.vpcs_vm.VPCSVM._check_requirements", return_value=True):
with asyncio_patch("asyncio.create_subprocess_exec", return_value=process):
nio = vm.port_add_nio_binding(0, {"type": "nio_udp", "lport": 4242, "rport": 4243, "rhost": "127.0.0.1"})
loop.run_until_complete(asyncio.async(vm.start()))
assert vm.is_running()
loop.run_until_complete(asyncio.async(vm.reload()))
assert vm.is_running() is True
process.terminate.assert_called_with()
def test_add_nio_binding_udp(vm):
nio = vm.port_add_nio_binding(0, {"type": "nio_udp", "lport": 4242, "rport": 4243, "rhost": "127.0.0.1"})
assert nio.lport == 4242