[at-spi2-core: 4/17] Extract duplicated function to check for the handling of unknown properties




commit cb203394cae381d4cfea75634b53a4f196647f9d
Author: Federico Mena Quintero <federico gnome org>
Date:   Thu Sep 1 15:03:34 2022 -0500

    Extract duplicated function to check for the handling of unknown properties

 tests/registryd/test_root_accessible.py  | 5 ++---
 tests/registryd/test_root_application.py | 5 ++---
 tests/registryd/utils.py                 | 7 +++++++
 3 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/tests/registryd/test_root_accessible.py b/tests/registryd/test_root_accessible.py
index a23a5ff8..8a6199a2 100644
--- a/tests/registryd/test_root_accessible.py
+++ b/tests/registryd/test_root_accessible.py
@@ -7,7 +7,7 @@
 import pytest
 import dbus
 
-from utils import get_property
+from utils import get_property, check_unknown_property_yields_error
 
 ACCESSIBLE_IFACE = 'org.a11y.atspi.Accessible'
 
@@ -23,5 +23,4 @@ def test_accessible_iface_properties(registry_root, session_manager):
         assert get_property(registry_root, ACCESSIBLE_IFACE, prop_name) == expected
 
 def test_unknown_property_yields_error(registry_root, session_manager):
-    with pytest.raises(dbus.exceptions.DBusException):
-        get_property(registry_root, ACCESSIBLE_IFACE, 'NonexistentProperty')
+    check_unknown_property_yields_error(registry_root, ACCESSIBLE_IFACE)
diff --git a/tests/registryd/test_root_application.py b/tests/registryd/test_root_application.py
index 2542f696..8816718d 100644
--- a/tests/registryd/test_root_application.py
+++ b/tests/registryd/test_root_application.py
@@ -7,7 +7,7 @@
 import pytest
 import dbus
 
-from utils import get_property
+from utils import get_property, check_unknown_property_yields_error
 
 APPLICATION_IFACE = 'org.a11y.atspi.Application'
 
@@ -21,5 +21,4 @@ def test_application_iface_properties(registry_root, session_manager):
         assert get_property(registry_root, APPLICATION_IFACE, prop_name) == expected
 
 def test_unknown_property_yields_error(registry_root, session_manager):
-    with pytest.raises(dbus.exceptions.DBusException):
-        get_property(registry_root, APPLICATION_IFACE, 'NonexistentProperty')
+    check_unknown_property_yields_error(registry_root, APPLICATION_IFACE)
diff --git a/tests/registryd/utils.py b/tests/registryd/utils.py
index 7245929c..612633d4 100644
--- a/tests/registryd/utils.py
+++ b/tests/registryd/utils.py
@@ -1,4 +1,11 @@
+import pytest
+import dbus
+
 PROPERTIES_IFACE = 'org.freedesktop.DBus.Properties'
 
 def get_property(proxy, iface_name, prop_name):
     return proxy.Get(iface_name, prop_name, dbus_interface=PROPERTIES_IFACE)
+
+def check_unknown_property_yields_error(obj, iface):
+    with pytest.raises(dbus.exceptions.DBusException):
+        get_property(obj, iface, 'NonexistentProperty')


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]