summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-10-18 18:43:50 +0200
committerBastien Nocera <hadess@hadess.net>2013-10-18 18:43:50 +0200
commit0741e5b591141e826c87e1aaa89b8e3fc2ec2565 (patch)
treed385e948a73ab026fb5ebfcfe8f1b8987c73ba8e /src
parent585ff606c0a096cdd2cb4aed2fe71a6bd71dc273 (diff)
downloadupower-0741e5b591141e826c87e1aaa89b8e3fc2ec2565.tar.gz
linux: Finish "fixing" the UPS test case
Update the expected warning levels to match, and add a big fat FIXME for the test case itself. That's not how UPSes work, or how UPower is expected to work.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/linux/integration-test14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/linux/integration-test b/src/linux/integration-test
index 19d1b2d..6adc5c4 100755
--- a/src/linux/integration-test
+++ b/src/linux/integration-test
@@ -499,6 +499,7 @@ class Tests(unittest.TestCase):
self.assertEqual(len(devs), 1)
ups0_up = devs[0]
+ self.assertEqual(self.get_dbus_dev_property(ups0_up, 'Vendor'), 'APC')
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'IsPresent'), True)
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'Percentage'), 70.0)
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'State'), UP_DEVICE_STATE_CHARGING)
@@ -521,7 +522,7 @@ class Tests(unittest.TestCase):
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'Percentage'), 70.0)
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'State'), UP_DEVICE_STATE_DISCHARGING)
self.assertEqual(self.get_dbus_property('OnBattery'), True)
- self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_NONE)
+ self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_DISCHARGING)
self.stop_daemon()
# low UPS charge
@@ -530,7 +531,7 @@ class Tests(unittest.TestCase):
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'Percentage'), 2.0)
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'State'), UP_DEVICE_STATE_DISCHARGING)
self.assertEqual(self.get_dbus_property('OnBattery'), True)
- self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_CRITICAL)
+ self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_ACTION)
self.stop_daemon()
# now add an offline AC, should still be on battery
@@ -543,14 +544,19 @@ class Tests(unittest.TestCase):
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'Percentage'), 2.0)
self.assertEqual(self.get_dbus_dev_property(ups0_up, 'State'), UP_DEVICE_STATE_DISCHARGING)
self.assertEqual(self.get_dbus_property('OnBattery'), True)
- self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_CRITICAL)
+ self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_ACTION)
self.stop_daemon()
# now plug in the AC, should switch to OnBattery=False
self.testbed.set_attribute(ac, 'online', '1')
self.start_daemon()
self.assertEqual(self.get_dbus_property('OnBattery'), False)
- self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_NONE)
+ # FIXME this is completely wrong
+ # The AC status doesn't change anything, the AC is what powers the UPS
+ # and the UPS powers the desktop
+ #
+ # A plugged in UPS is always the one supplying the computer
+ self.assertEqual(self.get_dbus_display_property('WarningLevel'), UP_DEVICE_LEVEL_ACTION)
self.stop_daemon()
def test_vendor_strings(self):