[telepathy-gabble/master] constants.py: add CONN_IFACE_LOCATION
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Thu Aug 6 07:29:46 PDT 2009
---
tests/twisted/constants.py | 1 +
tests/twisted/test-location.py | 20 +++++++++-----------
2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index e9e90dd..df8e253 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -54,6 +54,7 @@ CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts'
CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities.DRAFT'
CONN_IFACE_SIMPLE_PRESENCE = CONN + '.Interface.SimplePresence'
CONN_IFACE_REQUESTS = CONN + '.Interface.Requests'
+CONN_IFACE_LOCATION = CONN + '.Interface.Location.DRAFT'
STREAM_HANDLER = 'org.freedesktop.Telepathy.Media.StreamHandler'
diff --git a/tests/twisted/test-location.py b/tests/twisted/test-location.py
index 721fa90..2aab730 100644
--- a/tests/twisted/test-location.py
+++ b/tests/twisted/test-location.py
@@ -4,8 +4,6 @@ from servicetest import call_async, EventPattern
from twisted.words.xish import xpath
import constants as cs
-location_iface = \
- 'org.freedesktop.Telepathy.Connection.Interface.Location.DRAFT'
Rich_Presence_Access_Control_Type_Publish_List = 1
@@ -13,7 +11,7 @@ def test(q, bus, conn, stream):
# hack
import dbus
conn.interfaces['Location'] = \
- dbus.Interface(conn, location_iface)
+ dbus.Interface(conn, cs.CONN_IFACE_LOCATION)
conn.interfaces['Properties'] = \
dbus.Interface(conn, dbus.PROPERTIES_IFACE)
@@ -30,7 +28,7 @@ def test(q, bus, conn, stream):
# check location properties
access_control_types = conn.Get(
- location_iface, "LocationAccessControlTypes",
+ cs.CONN_IFACE_LOCATION, "LocationAccessControlTypes",
dbus_interface='org.freedesktop.DBus.Properties')
# only one access control is implemented in Gabble at the moment:
assert len(access_control_types) == 1, access_control_types
@@ -38,14 +36,14 @@ def test(q, bus, conn, stream):
Rich_Presence_Access_Control_Type_Publish_List
access_control = conn.Get(
- location_iface, "LocationAccessControl",
+ cs.CONN_IFACE_LOCATION, "LocationAccessControl",
dbus_interface='org.freedesktop.DBus.Properties')
assert len(access_control) == 2, access_control
assert access_control[0] == \
Rich_Presence_Access_Control_Type_Publish_List
properties = conn.GetAll(
- location_iface,
+ cs.CONN_IFACE_LOCATION,
dbus_interface='org.freedesktop.DBus.Properties')
assert properties.get('LocationAccessControlTypes') == access_control_types
@@ -58,7 +56,7 @@ def test(q, bus, conn, stream):
dbus.UInt32(0, variant_level=1)],
signature=dbus.Signature('uv'))
try:
- conn.Set (location_iface, 'LocationAccessControl', bad_access_control,
+ conn.Set (cs.CONN_IFACE_LOCATION, 'LocationAccessControl', bad_access_control,
dbus_interface ='org.freedesktop.DBus.Properties')
except dbus.DBusException, e:
pass
@@ -68,7 +66,7 @@ def test(q, bus, conn, stream):
# Bad type
bad_access_control = dbus.String("This should not be a string")
try:
- conn.Set (location_iface, 'LocationAccessControl', bad_access_control,
+ conn.Set (cs.CONN_IFACE_LOCATION, 'LocationAccessControl', bad_access_control,
dbus_interface ='org.freedesktop.DBus.Properties')
except dbus.DBusException, e:
assert e.get_dbus_name() == cs.INVALID_ARGUMENT, e.get_dbus_name()
@@ -80,7 +78,7 @@ def test(q, bus, conn, stream):
dbus.UInt32(0, variant_level=1)],
signature=dbus.Signature('ssv'))
try:
- conn.Set (location_iface, 'LocationAccessControl', bad_access_control,
+ conn.Set (cs.CONN_IFACE_LOCATION, 'LocationAccessControl', bad_access_control,
dbus_interface ='org.freedesktop.DBus.Properties')
except dbus.DBusException, e:
assert e.get_dbus_name() == cs.INVALID_ARGUMENT, e.get_dbus_name()
@@ -88,13 +86,13 @@ def test(q, bus, conn, stream):
assert False, "Should have had an error!"
# Correct
- conn.Set (location_iface, 'LocationAccessControl', access_control,
+ conn.Set (cs.CONN_IFACE_LOCATION, 'LocationAccessControl', access_control,
dbus_interface ='org.freedesktop.DBus.Properties')
# LocationAccessControlTypes is read-only, check Gabble return the
# PermissionDenied error
try:
- conn.Set (location_iface, 'LocationAccessControlTypes',
+ conn.Set (cs.CONN_IFACE_LOCATION, 'LocationAccessControlTypes',
access_control_types,
dbus_interface ='org.freedesktop.DBus.Properties')
except dbus.DBusException, e:
--
1.5.6.5
More information about the telepathy-commits
mailing list