mirror of
https://gitlab.freedesktop.org/upower/upower.git
synced 2026-02-04 09:30:29 +01:00
Linux integration tests: First test case for library
Start testing the client-side library through gobject-introspection. This covers https://bugs.freedesktop.org/show_bug.cgi?id=70283
This commit is contained in:
parent
03c4abbfb5
commit
e89d047680
2 changed files with 22 additions and 1 deletions
|
|
@ -137,7 +137,7 @@ endif
|
|||
|
||||
if UP_BUILD_TESTS
|
||||
check-local: upowerd
|
||||
env top_builddir=$(top_builddir) $(srcdir)/linux/integration-test -v
|
||||
env GI_TYPELIB_PATH=$(top_builddir)/libupower-glib:$(GI_REPOSITORY_PATH) LD_LIBRARY_PATH=$(top_builddir)/libupower-glib/.libs:$(LD_LIBRARY_PATH) top_builddir=$(top_builddir) $(srcdir)/linux/integration-test -v
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import time
|
|||
try:
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gio
|
||||
from gi.repository import UPowerGlib
|
||||
except ImportError as e:
|
||||
sys.stderr.write('Skipping tests, PyGobject not available for Python 3, or missing GI typelibs: %s\n' % str(e))
|
||||
sys.exit(0)
|
||||
|
|
@ -717,6 +718,26 @@ class Tests(unittest.TestCase):
|
|||
self.assertEqual(self.get_dbus_property('OnLowBattery'), False)
|
||||
self.stop_daemon()
|
||||
|
||||
#
|
||||
# libupower-glib tests (through introspection)
|
||||
#
|
||||
|
||||
def test_lib_daemon_properties(self):
|
||||
'''library GI: daemon properties'''
|
||||
|
||||
self.start_daemon()
|
||||
client = UPowerGlib.Client.new()
|
||||
self.assertTrue(client.get_properties_sync(None))
|
||||
self.assertRegex(client.get_daemon_version(), '^[0-9.]+$')
|
||||
self.assertIn(client.get_can_hibernate(), [False, True])
|
||||
self.assertIn(client.get_can_suspend(), [False, True])
|
||||
self.assertIn(client.get_is_docked(), [False, True])
|
||||
self.assertIn(client.get_lid_is_present(), [False, True])
|
||||
self.assertIn(client.get_lid_is_closed(), [False, True])
|
||||
self.assertEqual(client.get_on_battery(), False)
|
||||
self.assertEqual(client.get_on_low_battery(), False)
|
||||
|
||||
|
||||
#
|
||||
# Helper methods
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue