devices: interface: add coverage for new bridge changes

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-01-27 06:59:17 -05:00
parent e40f71a689
commit 3e5d530fce
1 changed files with 5 additions and 4 deletions

View File

@ -99,14 +99,15 @@ def _default_bridge(conn):
if _HOST_DEFAULT_BRIDGE == -1:
try:
ret = _host_default_bridge()
except Exception:
except Exception: # pragma: no cover
log.debug("Error getting host default bridge", exc_info=True)
ret = None
_HOST_DEFAULT_BRIDGE = ret
ret = _HOST_DEFAULT_BRIDGE
if conn.in_testsuite():
return "testsuitebr0"
return _HOST_DEFAULT_BRIDGE
ret = "testsuitebr0"
return ret
class _VirtualPort(XMLBuilder):
@ -263,7 +264,7 @@ class DeviceInterface(Device):
return
nettype = DeviceInterface.TYPE_BRIDGE
source = _default_bridge(self.conn)
source = DeviceInterface.default_bridge(self.conn)
if not source:
nettype = DeviceInterface.TYPE_VIRTUAL
source = "default"