diff --git a/tests/testdriver.xml b/tests/testdriver.xml index 040b93019..4edbd4c38 100644 --- a/tests/testdriver.xml +++ b/tests/testdriver.xml @@ -1731,8 +1731,8 @@ ba UPPER - 1000000 - 50000 + 10000000 + 500000 0700 @@ -1786,8 +1786,8 @@ ba backingl1.img - 1000000 - 50000 + 100000 + 5000 diff --git a/tests/uitests/test_createnet.py b/tests/uitests/test_createnet.py index b0f83ec0c..f108b6b07 100644 --- a/tests/uitests/test_createnet.py +++ b/tests/uitests/test_createnet.py @@ -51,10 +51,12 @@ class CreateNet(uiutils.UITestCase): stop.click() uiutils.check_in_loop(lambda: delete.sensitive) - # Delete it + # Delete it, clicking No first + delete.click() + self._click_alert_button("permanently delete the network", "No") + uiutils.check_in_loop(lambda: not cell.dead) delete.click() self._click_alert_button("permanently delete the network", "Yes") - # Ensure it's gone uiutils.check_in_loop(lambda: cell.dead) diff --git a/tests/uitests/test_createpool.py b/tests/uitests/test_createpool.py index 640102155..dd8fe5c7e 100644 --- a/tests/uitests/test_createpool.py +++ b/tests/uitests/test_createpool.py @@ -59,10 +59,12 @@ class CreatePool(uiutils.UITestCase): stop.click() uiutils.check_in_loop(lambda: delete.sensitive) - # Delete it + # Delete it, clicking 'No' first + delete.click() + self._click_alert_button("permanently delete the pool", "No") + uiutils.check_in_loop(lambda: not cell.dead) delete.click() self._click_alert_button("permanently delete the pool", "Yes") - # Ensure it's gone uiutils.check_in_loop(lambda: cell.dead) diff --git a/tests/uitests/test_createvol.py b/tests/uitests/test_createvol.py index 42c51997f..602ce5e5a 100644 --- a/tests/uitests/test_createvol.py +++ b/tests/uitests/test_createvol.py @@ -76,8 +76,17 @@ class CreateVol(uiutils.UITestCase): combo.find("qcow2", "menu item").click() win.find("Backing store").click_expander() win.find("Browse...").click() - browsewin = self.app.root.find( - "Choose Storage Volume", "frame") + browsewin = self.app.root.find("Choose Storage Volume", "frame") + # Test cancel button + browsewin.find("Cancel", "push button").click() + uiutils.check_in_loop(lambda: not browsewin.active) + win.find("Browse...").click() + browsewin = self.app.root.find("Choose Storage Volume", "frame") + # Test browse local opening + browsewin.find("Browse Local", "push button").click() + chooser = self.app.root.find( + "Locate existing storage", "file chooser") + chooser.keyCombo("F4") browsewin.find_fuzzy("default-pool", "table cell").click() browsewin.find("bochs-vol", "table cell").doubleClick() uiutils.check_in_loop(lambda: not browsewin.active) @@ -124,7 +133,8 @@ class CreateVol(uiutils.UITestCase): browsewin = self.app.root.find( "Choose Storage Volume", "frame") browsewin.find_fuzzy("disk-pool", "table cell").click() - browsewin.find("diskvol7", "table cell").doubleClick() + browsewin.find("diskvol7", "table cell").click() + browsewin.find("Choose Volume").click() finish.click() vollist.find(newname) diff --git a/tests/uitests/test_host.py b/tests/uitests/test_host.py index ea1c6781d..b898913cc 100644 --- a/tests/uitests/test_host.py +++ b/tests/uitests/test_host.py @@ -34,7 +34,7 @@ class Host(uiutils.UITestCase): win = self._open_host_window("Virtual Networks").find("network-grid") finish = win.find("Apply", "push button") - # Shut off a pool, do an XML edit, verify it + # Shut it off, do an XML edit, verify it win.find("default", "table cell").click() delete = win.find("net-delete", "push button") stop = win.find("net-stop", "push button") @@ -49,6 +49,17 @@ class Host(uiutils.UITestCase): win.find("Details", "page tab").click() self.assertEqual(win.find("net-device").text, newdev) + # Rename it + win.find("default", "table cell").click() + win.find("net-name").text = "newsort-default" + finish.click() + + # Change autostart, trigger it by clicking away + win.find("newsort-default", "table cell").click() + win.find("net-autostart").click() + win.find("netboot", "table cell").click() + self._click_alert_button("There are unapplied changes", "Yes") + # Do standard xmleditor tests self._test_xmleditor_interactions(win, finish) @@ -89,5 +100,83 @@ class Host(uiutils.UITestCase): win.find("Details", "page tab").click() self.assertEqual(win.find("pool-location").text, newpath) + # Rename it + win.find("default", "table cell").click() + win.find("pool-name").text = "newsort-default" + finish.click() + + # Change autostart. Trigger it by clicking on new cell + win.find("newsort-default", "table cell").click() + win.find("pool-autostart").click() + win.find("disk-pool", "table cell").click() + self._click_alert_button("There are unapplied changes", "Yes") + # Do standard xmleditor tests self._test_xmleditor_interactions(win, finish) + + def testHostStorageVolMisc(self): + """ + Misc actions involving volumes + """ + win = self._open_host_window("Storage").find("storage-grid") + win.find_fuzzy("default-pool", "table cell").click() + vollist = win.find("vol-list", "table") + + vol1 = vollist.find("backingl1.img", "table cell") + vol2 = vollist.find("UPPER", "table cell") + assert vol1.onscreen + assert not vol2.onscreen + win.find("Size", "table column header").click() + win.find("Size", "table column header").click() + uiutils.check_in_loop(lambda: not vol1.onscreen) + assert vol2.onscreen + + vol2.click(button=3) + self.app.root.find("Copy Volume Path", "menu item").click() + from gi.repository import Gdk, Gtk + clipboard = Gtk.Clipboard.get_default(Gdk.Display.get_default()) + assert clipboard.wait_for_text() == "/dev/default-pool/UPPER" + + def testHostConn(self): + """ + Change some connection parameters + """ + manager = self.app.topwin + # Disconnect the connection + c = manager.find_fuzzy("testdriver.xml", "table cell") + c.click(button=3) + self.app.root.find("conn-disconnect", "menu item").click() + uiutils.check_in_loop(lambda: "Not Connected" in c.text) + + # Open Host Details from right click menu + c.click(button=3) + self.app.root.find("conn-details", "menu item").click() + win = self.app.root.find_fuzzy("Connection Details", "frame") + + # Click the tabs and then back + win.find_fuzzy("Storage", "tab").click() + win.find_fuzzy("Network", "tab").click() + win.find_fuzzy("Overview", "tab").click() + + # Unset autoconnect + win.find("Autoconnect:", "check box").click() + + # Change the name, verify that title bar changed + win.find("Name:", "text").text = "FOOBAR" + self.app.root.find("FOOBAR Connection Details", "frame") + + # Open the manager window + win.find("File", "menu").click() + win.find("View Manager", "menu item").click() + uiutils.check_in_loop(lambda: manager.active) + # Confirm connection row is named differently in manager + manager.find("FOOBAR", "table cell") + + # Close the manager + manager.keyCombo("F4") + uiutils.check_in_loop(lambda: win.active) + + # Quit app from the file menu + win.find("File", "menu").click() + win.find("Quit", "menu item").click() + uiutils.check_in_loop(lambda: not self.app.is_running()) diff --git a/ui/hostnets.ui b/ui/hostnets.ui index 45c880c48..863c9bee5 100644 --- a/ui/hostnets.ui +++ b/ui/hostnets.ui @@ -113,6 +113,11 @@ True True + + + net-autostart + + 1 @@ -217,6 +222,11 @@ True True + + + net-name + + 1 diff --git a/ui/hoststorage.ui b/ui/hoststorage.ui index 7d9884400..77bd0a86f 100644 --- a/ui/hoststorage.ui +++ b/ui/hoststorage.ui @@ -1,5 +1,5 @@ - + @@ -331,6 +331,11 @@ True True + + + pool-autostart + + 1 @@ -360,6 +365,11 @@ True True + + + pool-name + + 1 diff --git a/virtManager/host.py b/virtManager/host.py index a7a349b2d..59f78c7ae 100644 --- a/virtManager/host.py +++ b/virtManager/host.py @@ -25,7 +25,7 @@ class vmmHost(vmmGObjectUI): if uri not in cls._instances: cls._instances[uri] = vmmHost(conn) cls._instances[uri].show() - except Exception as e: + except Exception as e: # pragma: no cover if not parentobj: raise parentobj.err.show_err( @@ -88,7 +88,7 @@ class vmmHost(vmmGObjectUI): vis = self.is_visible() self.topwin.present() if vis: - return + return # pragma: no cover vmmEngine.get_instance().increment_window_counter() diff --git a/virtManager/hostnets.py b/virtManager/hostnets.py index 7e5fb32fb..a51897e97 100644 --- a/virtManager/hostnets.py +++ b/virtManager/hostnets.py @@ -136,7 +136,7 @@ class vmmHostNets(vmmGObjectUI): self.conn.support.conn_network()) if conn_active and not self.conn.support.conn_network(): - self._set_error_page( + self._set_error_page( # pragma: no cover _("Libvirt connection does not support virtual network " "management.")) diff --git a/virtManager/hoststorage.py b/virtManager/hoststorage.py index f14ccad93..09c4fd344 100644 --- a/virtManager/hoststorage.py +++ b/virtManager/hoststorage.py @@ -148,7 +148,7 @@ class vmmHostStorage(vmmGObjectUI): # UI init # ########### - def _cap_sort_func_cb(self, model, iter1, iter2): + def _cap_sort_func_cb(self, model, iter1, iter2, userdata): def _cmp(a, b): return ((a > b) - (a < b)) @@ -511,7 +511,7 @@ class vmmHostStorage(vmmGObjectUI): def _pool_refresh_cb(self, src): pool = self._current_pool() if pool is None: - return + return # pragma: no cover self._confirm_changes() @@ -527,7 +527,7 @@ class vmmHostStorage(vmmGObjectUI): def _vol_copy_path_cb(self, src): vol = self._current_vol() if not vol: - return + return # pragma: no cover clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD) target_path = vol.get_target_path() @@ -537,7 +537,7 @@ class vmmHostStorage(vmmGObjectUI): def _vol_add_cb(self, src): pool = self._current_pool() if pool is None: - return + return # pragma: no cover log.debug("Launching 'Add Volume' wizard for pool '%s'", pool.get_name()) @@ -550,13 +550,13 @@ class vmmHostStorage(vmmGObjectUI): self._addvol.set_modal(self.topwin.get_modal()) self._addvol.set_name_hint(self._name_hint) self._addvol.show(self.topwin) - except Exception as e: + except Exception as e: # pragma: no cover self.err.show_err(_("Error launching volume wizard: %s") % str(e)) def _vol_delete_cb(self, src): vol = self._current_vol() if vol is None: - return + return # pragma: no cover pool = self._current_pool() result = self.err.yes_no(_("Are you sure you want to permanently " @@ -582,7 +582,7 @@ class vmmHostStorage(vmmGObjectUI): def _pool_apply(self): pool = self._current_pool() if pool is None: - return + return # pragma: no cover log.debug("Applying changes for pool '%s'", pool.get_name()) try: @@ -641,7 +641,7 @@ class vmmHostStorage(vmmGObjectUI): # select the vol we just created. pool = self._current_pool() if not pool or pool.get_connkey() != pool_connkey: - return + return # pragma: no cover # Select the new volume uiutil.set_list_selection(self.widget("vol-list"), volname)