1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-25 00:08:11 +00:00

Fixes tests.

This commit is contained in:
grossmj 2015-09-14 15:16:54 -06:00
parent 59f5de5de2
commit 47abba3c9c
4 changed files with 5 additions and 5 deletions

View File

@ -241,7 +241,7 @@ def test_iou_nio_create_ethernet_different_port(server, vm, ethernet_device):
def test_iou_nio_create_tap(server, vm, ethernet_device): def test_iou_nio_create_tap(server, vm, ethernet_device):
with patch("gns3server.modules.base_manager.BaseManager._has_privileged_access", return_value=True): with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
response = server.post("/projects/{project_id}/iou/vms/{vm_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_tap", response = server.post("/projects/{project_id}/iou/vms/{vm_id}/adapters/1/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_tap",
"tap_device": ethernet_device}) "tap_device": ethernet_device})
assert response.status == 201 assert response.status == 201

View File

@ -77,7 +77,7 @@ def test_vpcs_nio_create_udp(server, vm):
def test_vpcs_nio_create_tap(server, vm, ethernet_device): def test_vpcs_nio_create_tap(server, vm, ethernet_device):
with patch("gns3server.modules.base_manager.BaseManager._has_privileged_access", return_value=True): with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
response = server.post("/projects/{project_id}/vpcs/vms/{vm_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_tap", response = server.post("/projects/{project_id}/vpcs/vms/{vm_id}/adapters/0/ports/0/nio".format(project_id=vm["project_id"], vm_id=vm["vm_id"]), {"type": "nio_tap",
"tap_device": ethernet_device}) "tap_device": ethernet_device})
assert response.status == 201 assert response.status == 201

View File

@ -176,7 +176,7 @@ def test_add_nio_binding_udp(vm, loop):
def test_add_nio_binding_ethernet(vm, loop, ethernet_device): def test_add_nio_binding_ethernet(vm, loop, ethernet_device):
with patch("gns3server.modules.base_manager.BaseManager._has_privileged_access", return_value=True): with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
nio = Qemu.instance().create_nio(vm.qemu_path, {"type": "nio_generic_ethernet", "ethernet_device": ethernet_device}) nio = Qemu.instance().create_nio(vm.qemu_path, {"type": "nio_generic_ethernet", "ethernet_device": ethernet_device})
loop.run_until_complete(asyncio.async(vm.adapter_add_nio_binding(0, nio))) loop.run_until_complete(asyncio.async(vm.adapter_add_nio_binding(0, nio)))
assert nio.ethernet_device == ethernet_device assert nio.ethernet_device == ethernet_device

View File

@ -151,14 +151,14 @@ def test_add_nio_binding_udp(vm):
def test_add_nio_binding_tap(vm, ethernet_device): def test_add_nio_binding_tap(vm, ethernet_device):
with patch("gns3server.modules.base_manager.BaseManager._has_privileged_access", return_value=True): with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=True):
nio = VPCS.instance().create_nio(vm.vpcs_path, {"type": "nio_tap", "tap_device": ethernet_device}) nio = VPCS.instance().create_nio(vm.vpcs_path, {"type": "nio_tap", "tap_device": ethernet_device})
vm.port_add_nio_binding(0, nio) vm.port_add_nio_binding(0, nio)
assert nio.tap_device == ethernet_device assert nio.tap_device == ethernet_device
# def test_add_nio_binding_tap_no_privileged_access(vm): # def test_add_nio_binding_tap_no_privileged_access(vm):
# with patch("gns3server.modules.base_manager.BaseManager._has_privileged_access", return_value=False): # with patch("gns3server.modules.base_manager.BaseManager.has_privileged_access", return_value=False):
# with pytest.raises(aiohttp.web.HTTPForbidden): # with pytest.raises(aiohttp.web.HTTPForbidden):
# nio = VPCS.instance().create_nio(vm.vpcs_path, {"type": "nio_tap", "tap_device": "test"}) # nio = VPCS.instance().create_nio(vm.vpcs_path, {"type": "nio_tap", "tap_device": "test"})
# vm.port_add_nio_binding(0, nio) # vm.port_add_nio_binding(0, nio)