This only tests the situation where you've got a disk with one partition,
with a filesystem on that taking up the entire disk. That filesystem can
be deleted and then anaconda will have enough space to keep going.
There are certainly more tests that could be done with this dialog, and
that's what needs to be worked on next after verifying running multiple
tests at the same time works.
---
pyanaconda/ui/gui/spokes/lib/resize.glade | 7 +-
tests/gui/inside/storage.py | 110 +++++++++++++++++++++++++++++-
tests/gui/outside/test_reclaim.py | 56 +++++++++++++++
3 files changed, 171 insertions(+), 2 deletions(-)
create mode 100644 tests/gui/outside/test_reclaim.py
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade
b/pyanaconda/ui/gui/spokes/lib/resize.glade
index de1f800..223416c 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
+<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.0"/>
<object class="GtkTreeStore" id="diskStore">
@@ -362,5 +362,10 @@
<action-widget response="0">cancelButton</action-widget>
<action-widget response="2">resizeButton</action-widget>
</action-widgets>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="resizeDialog-atkobject">
+ <property name="AtkObject::accessible-name"
translatable="yes">Reclaim</property>
+ </object>
+ </child>
</object>
</interface>
diff --git a/tests/gui/inside/storage.py b/tests/gui/inside/storage.py
index 7d78231..374f802 100644
--- a/tests/gui/inside/storage.py
+++ b/tests/gui/inside/storage.py
@@ -16,6 +16,7 @@
# Author: Chris Lumens <clumens(a)redhat.com>
from dogtail.predicate import GenericPredicate
+from dogtail.utils import doDelay
from . import UITestCase
@@ -72,7 +73,7 @@ class BasicStorageTestCase(UITestCase):
self.assertFalse(button.checked, msg="Encrypt button should not be
selected")
def _run(self):
- # First, we need to click on the network spoke selector.
+ # First, we need to click on the storage spoke selector.
self.enter_spoke("INSTALLATION DESTINATION")
# Now verify we are on the right screen.
@@ -100,3 +101,110 @@ class BasicStorageTestCase(UITestCase):
# the hub. There's no need to display any other dialogs given that this is
# an install against empty disks and no other options were checked.
self.exit_spoke(node=w)
+
+class BasicReclaimTestCase(BasicStorageTestCase):
+ def check_reclaim_buttons_before(self, dlg):
+ # Test initial sensitivity of widgets upon entering the reclaim dialog. A
+ # partition should be selected in the view, the only way out should be via
+ # the Cancel button, and the only operation available on the selected partition
+ # should be deleting.
+ button = self.find("Preserve", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Preserve button not found")
+ self.assertFalse(button.sensitive, msg="Preserve button should be
insensitive")
+
+ button = self.find("Delete", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Delete button not found")
+ self.assertTrue(button.sensitive, msg="Delete button should be
sensitive")
+
+ button = self.find("Shrink", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Shrink button not found")
+ self.assertFalse(button.sensitive, msg="Shrink button should be
insensitive")
+
+ button = self.find("Delete all", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Delete all button not found")
+ self.assertTrue(button.sensitive, msg="Delete all button should be
sensitive")
+
+ button = self.find("Cancel", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Cancel button not found")
+ self.assertTrue(button.sensitive, msg="Cancel button should be
sensitive")
+
+ button = self.find("Reclaim space", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Reclaim button not found")
+ self.assertFalse(button.sensitive, msg="Reclaim button should be
insensitive")
+
+ def check_reclaim_buttons_after(self, dlg):
+ # Test sensitivity of widgets now that enough space has been freed up on disks
+ # to continue. The Preserve buttons should be the only available operations,
+ # Delete all should have been renamed to Preserve All, and there should now be
+ # two ways out of the dialog.
+ button = self.find("Preserve", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Preserve button not found")
+ self.assertTrue(button.sensitive, msg="Preserve button should be
sensitive")
+
+ button = self.find("Delete", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Delete button not found")
+ self.assertFalse(button.sensitive, msg="Delete button should be
insensitive")
+
+ button = self.find("Shrink", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Shrink button not found")
+ self.assertFalse(button.sensitive, msg="Shrink button should be
insensitive")
+
+ button = self.find("Preserve all", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Preserve all button not found")
+ self.assertTrue(button.sensitive, msg="Preserve all button should be
sensitive")
+
+ button = self.find("Cancel", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Cancel button not found")
+ self.assertTrue(button.sensitive, msg="Cancel button should be
sensitive")
+
+ button = self.find("Reclaim space", "push button", node=dlg)
+ self.assertIsNotNone(button, msg="Reclaim button not found")
+ self.assertTrue(button.sensitive, msg="Reclaim button should be
sensitive")
+
+ def check_reclaim(self, optionsDlg):
+ self.click_button("Reclaim space", node=optionsDlg)
+
+ # Verify we are on the reclaim dialog.
+ reclaimDlg = self.check_dialog_displayed("Reclaim")
+ self.check_reclaim_buttons_before(reclaimDlg)
+
+ # Click the Delete all button to free up enough space.
+ self.click_button("Delete all", node=reclaimDlg)
+ self.check_reclaim_buttons_after(reclaimDlg)
+
+ # Click on Reclaim space, which should take us all the way back to the hub.
+ self.click_button("Reclaim space", node=reclaimDlg)
+ doDelay(5)
+ self.check_window_displayed("INSTALLATION SUMMARY")
+
+ def _run(self):
+ # First, we need to click on the storage spoke selector.
+ self.enter_spoke("INSTALLATION DESTINATION")
+
+ # Now verify we are on the right screen.
+ w = self.check_window_displayed("INSTALLATION DESTINATION")
+ self.check_help_button(w)
+
+ # Given that we attach a second disk to the system (for storing the test
+ # suite and results), anaconda will not select disks by default. Thus,
+ # the storage options panel should currently be insensitive.
+ area = self.find("Storage Options", node=w)
+ self.assertIsNotNone(area, "Storage Options not found")
+ self.assertFalse(area.sensitive, msg="Storage options should be
insensitive")
+
+ # Select disk overviews. In the basic case, this means uninitialized
+ # disks that we're going to do autopart on.
+ self.check_select_disks(w)
+
+ # And now with disks selected, the storage options should be sensitive.
+ self.assertTrue(area.sensitive, msg="Storage options should be
sensitive")
+
+ self.check_shopping_cart(w)
+ self.check_storage_options(w)
+
+ # Clicking the Done button should bring up the installation options dialog
+ # indicating there's not currently enough space to install, but more space
+ # can be made by going to the reclaim dialog.
+ self.click_button("_Done", node=w)
+ optionsDlg = self.check_dialog_displayed("Need Space")
+ self.check_reclaim(optionsDlg)
diff --git a/tests/gui/outside/test_reclaim.py b/tests/gui/outside/test_reclaim.py
new file mode 100644
index 0000000..8f7de0d
--- /dev/null
+++ b/tests/gui/outside/test_reclaim.py
@@ -0,0 +1,56 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <
http://www.gnu.org/licenses/>.
+#
+# Author: Chris Lumens <clumens(a)redhat.com>
+
+__all__ = ["BasicReclaimLiveCDCreator",
"BasicReclaimLiveCD_OutsideTest"]
+
+from . import Creator, OutsideMixin
+import subprocess
+import unittest
+
+class BasicReclaimLiveCDCreator(Creator):
+ drives = [("one", 8)]
+ name = "basicreclaimlivecd"
+
+ # This does not test every spoke, as we only need to do enough to satisfy anaconda
+ # and get us onto the progress hub.
+ tests = [("welcome", "BasicWelcomeTestCase"),
+ ("summary", "LiveCDSummaryTestCase"),
+ ("storage", "BasicReclaimTestCase"),
+ ("progress", "LiveCDProgressTestCase"),
+ ("rootpassword", "BasicRootPasswordTestCase"),
+ ("progress", "LiveCDFinishTestCase")]
+
+ def makeDrives(self):
+ Creator.makeDrives(self)
+
+ # Put a partition and filesystem across the whole disk, which will
+ # force anaconda to display the reclaim dialog.
+ for (drive, size) in self.drives:
+ subprocess.call(["/sbin/parted", "-s",
self._drivePaths[drive], "mklabel", "msdos"],
+ stdout=open("/dev/null", "w"),
+ stderr=open("/dev/null", "w"))
+ subprocess.call(["/sbin/parted", "-s",
self._drivePaths[drive], "mkpart", "p", "ext2",
"0", str(size) + "G"],
+ stdout=open("/dev/null", "w"),
+ stderr=open("/dev/null", "w"))
+ subprocess.call(["/sbin/mkfs.ext4", "-F",
self._drivePaths[drive]],
+ stdout=open("/dev/null", "w"),
+ stderr=open("/dev/null", "w"))
+
+class BasicReclaimLiveCD_OutsideTest(OutsideMixin, unittest.TestCase):
+ creatorClass = BasicReclaimLiveCDCreator
--
1.9.3