summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2023-07-04 15:20:20 +0200
committerBastien Nocera <hadess@hadess.net>2023-07-04 15:20:20 +0200
commit95de7181dd46edf0fddb6b1e5a6684ffeed50375 (patch)
tree2a946fff76fd7c07a4523312c8a66dee62ad5d0e
parentd74536fa0ede7822f2db671a5e1785121d5b1946 (diff)
linux: Add test for is-present changes at runtime
-rwxr-xr-xsrc/linux/integration-test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/linux/integration-test.py b/src/linux/integration-test.py
index 30a3b52..baec125 100755
--- a/src/linux/integration-test.py
+++ b/src/linux/integration-test.py
@@ -1445,6 +1445,20 @@ class Tests(dbusmock.DBusTestCase):
self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'Model'), 'Fancy BT mouse')
self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'IsPresent'), False)
+ self.testbed.set_attribute(mousebat0, 'capacity', '100')
+ self.testbed.set_attribute(mousebat0, 'present', '1')
+ self.testbed.uevent(mousebat0, 'change')
+
+ self.assertEventually(lambda: self.get_dbus_dev_property(mousebat0_up, 'IsPresent'), value=True)
+ self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'IsPresent'), True)
+
+ self.testbed.set_attribute(mousebat0, 'capacity', '0')
+ self.testbed.set_attribute(mousebat0, 'present', '0')
+ self.testbed.uevent(mousebat0, 'change')
+
+ self.assertEventually(lambda: self.get_dbus_dev_property(mousebat0_up, 'IsPresent'), value=False)
+ self.assertEqual(self.get_dbus_dev_property(mousebat0_up, 'IsPresent'), False)
+
def test_bluetooth_mouse(self):
'''bluetooth mouse battery'''