summaryrefslogtreecommitdiff
path: root/tests/registryd
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2022-12-06 13:43:52 -0600
committerFederico Mena Quintero <federico@gnome.org>2022-12-06 14:06:01 -0600
commite27788e63ba58168b62cf20e19b4f129c8673304 (patch)
treeb6316875f3dc84ad37698ae79b070f12d78a9a22 /tests/registryd
parent12e0116d37e2349f028970069d6e31d413995d6b (diff)
downloadat-spi2-core-e27788e63ba58168b62cf20e19b4f129c8673304.tar.gz
test_introspection.py: Factor out function to test a set of advertised interfaces
Diffstat (limited to 'tests/registryd')
-rw-r--r--tests/registryd/test_introspection.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/tests/registryd/test_introspection.py b/tests/registryd/test_introspection.py
index 64845630..98ebfc92 100644
--- a/tests/registryd/test_introspection.py
+++ b/tests/registryd/test_introspection.py
@@ -4,8 +4,10 @@ import xml.etree.ElementTree as ElementTree
INTROSPECTABLE_IFACE = 'org.freedesktop.DBus.Introspectable'
-def test_introspect(registry_root, session_manager):
- xml_str = str(registry_root.Introspect(dbus_interface=INTROSPECTABLE_IFACE))
+# obj: a dbus proxy object to introspect
+# expected_ifaces: sequence of interface names as strings
+def check_object_supports_interfaces(obj, expected_ifaces):
+ xml_str = str(obj.Introspect(dbus_interface=INTROSPECTABLE_IFACE))
root = ElementTree.fromstring(xml_str)
assert root.tag == 'node'
@@ -14,7 +16,16 @@ def test_introspect(registry_root, session_manager):
iface_names = list(iface_names)
iface_names.sort()
- assert iface_names == ['org.a11y.atspi.Accessible',
- 'org.a11y.atspi.Component',
- 'org.a11y.atspi.Socket',
- ]
+ expected_ifaces.sort()
+
+ assert iface_names == expected_ifaces
+
+# Test that the root object at /org/a11y/atspi/accessible/root advertises the correct interfaces
+def test_introspect_root(registry_root, session_manager):
+ check_object_supports_interfaces(
+ registry_root,
+ ['org.a11y.atspi.Accessible',
+ 'org.a11y.atspi.Component',
+ 'org.a11y.atspi.Socket',
+ ]
+ )