diff options
author | Bastien Nocera <hadess@hadess.net> | 2018-03-05 15:13:19 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2018-03-05 16:40:19 +0100 |
commit | f893c2a3c7c71e4822c2a453fe1deaffb6d30adb (patch) | |
tree | a0fbe78a9730e6bb4809f6ab695f5ef6a05928be | |
parent | 42fc617dbe0c40bc25d62626b6c874bfb1b95f6f (diff) | |
download | gnome-settings-daemon-f893c2a3c7c71e4822c2a453fe1deaffb6d30adb.tar.gz |
power: Fix keyboard brightness test
The error we'd have gotten from the keyboard brightness test when
gsd-power crash obviously wouldn't match that returned by gsd-power.
Check the error in details to make sure that the error matches our
expectations.
-rwxr-xr-x | plugins/power/test.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/power/test.py b/plugins/power/test.py index c1f666a2..3157c6b0 100755 --- a/plugins/power/test.py +++ b/plugins/power/test.py @@ -892,10 +892,14 @@ class PowerPluginTest(gsdtestcase.GSDTestCase): 'org.gnome.SettingsDaemon.Power', '/org/gnome/SettingsDaemon/Power') obj_gsd_power_kbd_props = dbus.Interface(obj_gsd_power_kbd, dbus.PROPERTIES_IFACE) - # This would cause: - # DBusException: org.freedesktop.DBus.Error.Failed: Failed to get property: Brightness - # if gsd-power crashed - kbd_brightness = obj_gsd_power_kbd_props.Get('org.gnome.SettingsDaemon.Power.Keyboard', 'Brightness') + # Will return -1 if gsd-power crashed, and an exception if the code caught the problem + with self.assertRaises(dbus.DBusException) as exc: + kbd_brightness = obj_gsd_power_kbd_props.Get('org.gnome.SettingsDaemon.Power.Keyboard', 'Brightness') + + # We should not have arrived here, if we did then the test failed, let's print this to help debugging + print('Got keyboard brightness: {}'.format(kbd_brightness)) + + self.assertEqual(exc.exception.get_dbus_message(), 'Failed to get property Brightness on interface org.gnome.SettingsDaemon.Power.Keyboard') def disabled_test_unindle_on_ac_plug(self): idle_delay = round(gsdpowerconstants.MINIMUM_IDLE_DIM_DELAY / gsdpowerconstants.IDLE_DELAY_TO_IDLE_DIM_MULTIPLIER) |