Fix ethernet interfaces tests if eth0 doesn't exists

Also on Windows and MacOS it return error if we try
to use a non existing interfaces.

Fix #230
This commit is contained in:
Julien Duponchelle committed 2015-06-09 16:35:21 +02:00
1 parent bd4b6396a8
commit 7c7f8fe3ed
7 files changed
+38 -27

No files matched your search

+3 -3
View File
@@ -136,11 +136,11 @@ def test_add_nio_binding_udp(vm, loop):
assert nio.lport == 4242
def test_add_nio_binding_ethernet(vm, loop):
def test_add_nio_binding_ethernet(vm, loop, ethernet_device):
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": "eth0"})
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)))
assert nio.ethernet_device == "eth0"
assert nio.ethernet_device == ethernet_device
def test_port_remove_nio_binding(vm, loop):
+2 -2
View File
@@ -150,9 +150,9 @@ def test_add_nio_binding_udp(vm):
assert nio.lport == 4242
def test_add_nio_binding_tap(vm):
def test_add_nio_binding_tap(vm, ethernet_device):
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": "test"})
nio = VPCS.instance().create_nio(vm.vpcs_path, {"type": "nio_tap", "tap_device": ethernet_device})
vm.port_add_nio_binding(0, nio)
assert nio.tap_device == "test"