uitests: Finish netlist.py coverage
Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
parent
ea49c1d932
commit
5ccbcb898f
|
@ -2,6 +2,7 @@
|
|||
# See the COPYING file in the top-level directory.
|
||||
|
||||
import time
|
||||
import unittest.mock
|
||||
|
||||
import tests
|
||||
from tests.uitests import utils as uiutils
|
||||
|
@ -797,3 +798,29 @@ class NewVM(uiutils.UITestCase):
|
|||
newvm.find_fuzzy("Finish", "button").click()
|
||||
self._click_alert_button("start the network", "Yes")
|
||||
self.assertFalse(newvm.showing)
|
||||
|
||||
@unittest.mock.patch.dict('os.environ', {"VIRTINST_TEST_SUITE": "1"})
|
||||
def testNewVMDefaultBridge(self):
|
||||
"""
|
||||
We actually set the unittest env variable here, which
|
||||
sets a fake bridge in interface.py
|
||||
"""
|
||||
self.app.uri = tests.utils.URIs.test_empty
|
||||
newvm = self._open_create_wizard()
|
||||
|
||||
newvm.find_fuzzy("Import", "radio").click()
|
||||
newvm.find_fuzzy(None,
|
||||
"text", "existing storage").text = __file__
|
||||
self.forward(newvm)
|
||||
newvm.find("oslist-entry").text = "generic"
|
||||
newvm.find("oslist-popover").find_fuzzy("generic").click()
|
||||
self.forward(newvm)
|
||||
self.forward(newvm)
|
||||
combo = newvm.find(None, "combo box", "Network source:")
|
||||
# For some reason atspi reports the internal combo value
|
||||
assert combo.name == 'bridge'
|
||||
assert newvm.find("Device name:", "text").text == "testsuitebr0"
|
||||
|
||||
newvm.find_fuzzy("Finish", "button").click()
|
||||
self.app.root.find_fuzzy("vm1 on", "frame")
|
||||
self.assertFalse(newvm.showing)
|
||||
|
|
|
@ -32,10 +32,6 @@ def _build_row(nettype, source_name,
|
|||
return row
|
||||
|
||||
|
||||
def _build_label_row(label, active):
|
||||
return _build_row(None, None, label, active)
|
||||
|
||||
|
||||
def _build_manual_row(nettype, label):
|
||||
return _build_row(nettype, None, label, True, manual=True)
|
||||
|
||||
|
@ -45,9 +41,7 @@ def _pretty_network_desc(nettype, source=None, netobj=None):
|
|||
return _("Usermode networking")
|
||||
|
||||
extra = None
|
||||
if nettype == virtinst.DeviceInterface.TYPE_BRIDGE:
|
||||
ret = _("Bridge")
|
||||
elif nettype == virtinst.DeviceInterface.TYPE_VIRTUAL:
|
||||
if nettype == virtinst.DeviceInterface.TYPE_VIRTUAL:
|
||||
ret = _("Virtual network")
|
||||
if netobj:
|
||||
extra = ": %s" % netobj.pretty_forward_mode()
|
||||
|
@ -246,7 +240,7 @@ class vmmNetworkList(vmmGObjectUI):
|
|||
if _source and row[NET_ROW_SOURCE] != _source:
|
||||
continue
|
||||
if _manual and row[NET_ROW_MANUAL] != _manual:
|
||||
continue
|
||||
continue # pragma: no cover
|
||||
return row.iter
|
||||
|
||||
# Find the matching row in the net list
|
||||
|
@ -344,7 +338,7 @@ class vmmNetworkList(vmmGObjectUI):
|
|||
|
||||
model = netlist.get_model()
|
||||
if not model:
|
||||
return
|
||||
return # pragma: no cover
|
||||
|
||||
try:
|
||||
if model:
|
||||
|
@ -358,8 +352,6 @@ class vmmNetworkList(vmmGObjectUI):
|
|||
netlist.set_active_iter(row.iter)
|
||||
return
|
||||
|
||||
if default_idx is None:
|
||||
default_idx = 0
|
||||
netlist.set_active(default_idx)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue