[Telepathy-commits] [telepathy-gabble/master] Location: test the D-Bus properties

Alban Crequy alban.crequy at collabora.co.uk
Sun Feb 1 05:24:03 PST 2009


---
 tests/twisted/test-location.py |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/tests/twisted/test-location.py b/tests/twisted/test-location.py
index bf82e60..2cdd428 100644
--- a/tests/twisted/test-location.py
+++ b/tests/twisted/test-location.py
@@ -13,6 +13,8 @@ def test(q, bus, conn, stream):
     import dbus
     conn.interfaces['Location'] = \
         dbus.Interface(conn, location_iface)
+    conn.interfaces['Properties'] = \
+        dbus.Interface(conn, 'org.freedesktop.DBus.Properties')
 
     conn.Connect()
 
@@ -46,9 +48,29 @@ def test(q, bus, conn, stream):
     assert properties.get('LocationAccessControlTypes') == access_control_types
     assert properties.get('LocationAccessControl') == access_control
 
-    # Test setting the properties (even if unimplemented)
+    # Test setting the properties
+    bad_access_control = dbus.Struct([dbus.UInt32(99),
+            dbus.UInt32(0, variant_level=1)],
+            signature=dbus.Signature('uv'))
+    try:
+        conn.Set (location_iface, 'LocationAccessControl', bad_access_control,
+            dbus_interface ='org.freedesktop.DBus.Properties')
+    except dbus.DBusException, e:
+        pass
+    else:
+        assert False, "Should have had an error!"
+
     conn.Set (location_iface, 'LocationAccessControl', access_control,
         dbus_interface ='org.freedesktop.DBus.Properties')
+    # LocationAccessControlType is read-only, we just test it does not crash
+    try:
+        conn.Set (location_iface, 'LocationAccessControlType',
+            access_control_types,
+            dbus_interface ='org.freedesktop.DBus.Properties')
+    except dbus.DBusException, e:
+        pass
+    else:
+        assert False, "Should have had an error!"
 
     conn.Location.SetLocation({
         'lat': dbus.Double(0.0, variant_level=1), 'lon': 0.0})
-- 
1.5.6.5




More information about the Telepathy-commits mailing list