telepathy-gabble: tests: use constants instead of o.fd.T
Simon McVittie
smcv at kemper.freedesktop.org
Mon Sep 23 02:38:40 PDT 2013
Module: telepathy-gabble
Branch: master
Commit: be26cb76591d3a6e9b25d51a631bb45e6c45b45f
URL: http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=be26cb76591d3a6e9b25d51a631bb45e6c45b45f
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Fri Sep 20 14:23:25 2013 +0100
tests: use constants instead of o.fd.T
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69618
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
---
tests/twisted/console.py | 3 ++-
tests/twisted/constants.py | 4 ++++
tests/twisted/gateways.py | 2 +-
tests/twisted/plugin-channel-managers.py | 2 +-
tests/twisted/presence/set-idempotence.py | 8 ++++----
tests/twisted/servicetest.py | 6 +++---
tests/twisted/sidecar-own-caps.py | 2 +-
tests/twisted/sidecars.py | 2 +-
tests/twisted/test-debug.py | 11 +++++------
tests/twisted/vcard/get-contact-info.py | 2 +-
10 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/tests/twisted/console.py b/tests/twisted/console.py
index 95c76a3..43ed55e 100644
--- a/tests/twisted/console.py
+++ b/tests/twisted/console.py
@@ -10,8 +10,9 @@ from gabbletest import exec_test, acknowledge_iq, elem, elem_iq
from config import PLUGINS_ENABLED
from twisted.words.xish import domish
import ns
+import constants as cs
-CONSOLE_PLUGIN_IFACE = "org.freedesktop.Telepathy.Gabble.Plugin.Console"
+CONSOLE_PLUGIN_IFACE = cs.PREFIX + ".Gabble.Plugin.Console"
STACY = 'stacy at pilgrim.lit'
if not PLUGINS_ENABLED:
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index 2b46165..e1d3dfe 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -188,6 +188,7 @@ CONN_IFACE_POWER_SAVING = CONN + '.Interface.PowerSaving'
CONN_IFACE_CONTACT_BLOCKING = CONN + '.Interface.ContactBlocking'
CONN_IFACE_ADDRESSING = CONN + '.Interface.Addressing1'
+ATTR_CONTACT_ID = CONN + '/contact-id'
ATTR_CONTACT_CAPABILITIES = CONN_IFACE_CONTACT_CAPS + '/capabilities'
ATTR_PRESENCE = CONN_IFACE_SIMPLE_PRESENCE + '/presence'
@@ -535,3 +536,6 @@ ROOM_SERVER = CHANNEL_IFACE_ROOM + '.Server'
SUBJECT = CHANNEL_IFACE_ROOM + '.Subject'
SUBJECT_PRESENT = 1
SUBJECT_CAN_SET = 2
+
+DEBUG_IFACE = PREFIX + '.Debug'
+DEBUG_PATH = '/' + PREFIX.replace('.', '/') + '/debug'
diff --git a/tests/twisted/gateways.py b/tests/twisted/gateways.py
index d4073dd..cffa407 100644
--- a/tests/twisted/gateways.py
+++ b/tests/twisted/gateways.py
@@ -16,7 +16,7 @@ import constants as cs
import ns
from config import PLUGINS_ENABLED
-PLUGIN_IFACE = "org.freedesktop.Telepathy.Gabble.Plugin.Gateways"
+PLUGIN_IFACE = cs.PREFIX + ".Gabble.Plugin.Gateways"
if not PLUGINS_ENABLED:
print "NOTE: built without --enable-plugins, not testing plugins"
diff --git a/tests/twisted/plugin-channel-managers.py b/tests/twisted/plugin-channel-managers.py
index 320dd7a..f324ea8 100644
--- a/tests/twisted/plugin-channel-managers.py
+++ b/tests/twisted/plugin-channel-managers.py
@@ -9,7 +9,7 @@ from gabbletest import exec_test, send_error_reply, acknowledge_iq, sync_stream
import constants as cs
from config import PLUGINS_ENABLED
-TEST_PLUGIN_IFACE = "org.freedesktop.Telepathy.Gabble.Plugin.Test"
+TEST_PLUGIN_IFACE = cs.PREFIX + ".Gabble.Plugin.Test"
if not PLUGINS_ENABLED:
print "NOTE: built without --enable-plugins, not testing plugins"
diff --git a/tests/twisted/presence/set-idempotence.py b/tests/twisted/presence/set-idempotence.py
index dc11ceb..02f519e 100644
--- a/tests/twisted/presence/set-idempotence.py
+++ b/tests/twisted/presence/set-idempotence.py
@@ -24,7 +24,7 @@ def run_test(q, bus, conn, stream):
assert simple_signal.args == [{1L: (3L, u'away', u'gone')}]
assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L:
{ cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (3L, u'away', u'gone'),
- 'org.freedesktop.Telepathy.Connection/contact-id':
+ cs.ATTR_CONTACT_ID:
'test at localhost'}}
children = list(presence.stanza.elements())
@@ -38,7 +38,7 @@ def run_test(q, bus, conn, stream):
conn.SimplePresence.SetPresence('away', 'gone')
assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L:
{ cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (3L, u'away', u'gone'),
- 'org.freedesktop.Telepathy.Connection/contact-id':
+ cs.ATTR_CONTACT_ID:
'test at localhost'}}
# Set presence a third time. This call is not redundant, and should
@@ -55,7 +55,7 @@ def run_test(q, bus, conn, stream):
assert str(children[0]) == 'yo'
assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L:
{ cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (2L, u'available', u'yo'),
- 'org.freedesktop.Telepathy.Connection/contact-id':
+ cs.ATTR_CONTACT_ID:
'test at localhost'}}
# call SetPresence with an empty message, as this used to cause a
@@ -68,7 +68,7 @@ def run_test(q, bus, conn, stream):
assert simple_signal.args == [{1L: (2L, u'available', u'')}]
assert conn.Contacts.GetContactAttributes([1], [cs.CONN_IFACE_SIMPLE_PRESENCE], False) == { 1L:
{ cs.CONN_IFACE_SIMPLE_PRESENCE + "/presence": (2L, u'available', u''),
- 'org.freedesktop.Telepathy.Connection/contact-id':
+ cs.ATTR_CONTACT_ID:
'test at localhost'}}
if __name__ == '__main__':
diff --git a/tests/twisted/servicetest.py b/tests/twisted/servicetest.py
index 31c00f4..894d00b 100644
--- a/tests/twisted/servicetest.py
+++ b/tests/twisted/servicetest.py
@@ -19,8 +19,8 @@ from twisted.internet import reactor
import constants as cs
-tp_name_prefix = 'org.freedesktop.Telepathy'
-tp_path_prefix = '/org/freedesktop/Telepathy'
+tp_name_prefix = cs.PREFIX
+tp_path_prefix = '/' + cs.PREFIX.replace('.', '/')
class DictionarySupersetOf (object):
"""Utility class for expecting "a dictionary with at least these keys"."""
@@ -433,7 +433,7 @@ def sync_dbus(bus, q, conn):
assert conn.object.bus_name.startswith(':')
root_object = bus.get_object(conn.object.bus_name, '/', introspect=False)
call_async(q,
- dbus.Interface(root_object, 'org.freedesktop.Telepathy.Tests'),
+ dbus.Interface(root_object, cs.PREFIX + '.Tests'),
'DummySyncDBus')
q.expect('dbus-error', method='DummySyncDBus')
diff --git a/tests/twisted/sidecar-own-caps.py b/tests/twisted/sidecar-own-caps.py
index 3cbed76..dc16c8e 100644
--- a/tests/twisted/sidecar-own-caps.py
+++ b/tests/twisted/sidecar-own-caps.py
@@ -12,7 +12,7 @@ import constants as cs
import ns
from config import PLUGINS_ENABLED
-TEST_PLUGIN_IFACE = "org.freedesktop.Telepathy.Gabble.Plugin.Test"
+TEST_PLUGIN_IFACE = cs.PREFIX + ".Gabble.Plugin.Test"
if not PLUGINS_ENABLED:
print "NOTE: built without --enable-plugins, skipping"
diff --git a/tests/twisted/sidecars.py b/tests/twisted/sidecars.py
index caeed8d..61b863d 100644
--- a/tests/twisted/sidecars.py
+++ b/tests/twisted/sidecars.py
@@ -9,7 +9,7 @@ from gabbletest import exec_test, send_error_reply, acknowledge_iq, sync_stream
import constants as cs
from config import PLUGINS_ENABLED
-TEST_PLUGIN_IFACE = "org.freedesktop.Telepathy.Gabble.Plugin.Test"
+TEST_PLUGIN_IFACE = cs.PREFIX + ".Gabble.Plugin.Test"
if not PLUGINS_ENABLED:
print "NOTE: built without --enable-plugins, not testing plugins"
diff --git a/tests/twisted/test-debug.py b/tests/twisted/test-debug.py
index 9185342..e17bde9 100644
--- a/tests/twisted/test-debug.py
+++ b/tests/twisted/test-debug.py
@@ -10,8 +10,6 @@ from servicetest import EventPattern
from gabbletest import exec_test
import constants as cs
from config import DEBUGGING
-path = '/org/freedesktop/Telepathy/debug'
-iface = 'org.freedesktop.Telepathy.Debug'
def test(q, bus, conn, stream):
messages = []
@@ -19,7 +17,8 @@ def test(q, bus, conn, stream):
def new_message(timestamp, domain, level, string):
messages.append((timestamp, domain, level, string))
- debug = ProxyWrapper(bus.get_object(conn.bus_name, path), iface)
+ debug = ProxyWrapper(bus.get_object(conn.bus_name, cs.DEBUG_PATH),
+ cs.DEBUG_IFACE)
debug.connect_to_signal('NewDebugMessage', new_message)
if not DEBUGGING:
@@ -34,8 +33,8 @@ def test(q, bus, conn, stream):
# Turn signalling on and generate some messages.
assert len(messages) == 0
- assert debug.Properties.Get(iface, 'Enabled') == False
- debug.Properties.Set(iface, 'Enabled', True)
+ assert debug.Properties.Get(cs.DEBUG_IFACE, 'Enabled') == False
+ debug.Properties.Set(cs.DEBUG_IFACE, 'Enabled', True)
channel_path = conn.RequestChannel(
cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, conn.Properties.Get(cs.CONN, "SelfHandle"), True)
@@ -47,7 +46,7 @@ def test(q, bus, conn, stream):
# Turn signalling off and check we don't get any more messages.
- debug.Properties.Set(iface, 'Enabled', False)
+ debug.Properties.Set(cs.DEBUG_IFACE, 'Enabled', False)
sync_dbus(bus, q, conn)
snapshot = list(messages)
diff --git a/tests/twisted/vcard/get-contact-info.py b/tests/twisted/vcard/get-contact-info.py
index 6c61ecd..2a509f8 100644
--- a/tests/twisted/vcard/get-contact-info.py
+++ b/tests/twisted/vcard/get-contact-info.py
@@ -62,7 +62,7 @@ def test(q, bus, conn, stream):
# check the ContactAttribute
assertEquals(
{handle: {cs.CONN_IFACE_CONTACT_INFO + '/info': contact_info,
- 'org.freedesktop.Telepathy.Connection/contact-id': 'bob at foo.com'}},
+ cs.ATTR_CONTACT_ID: 'bob at foo.com'}},
conn.Contacts.GetContactAttributes([handle],
[cs.CONN_IFACE_CONTACT_INFO], False))
More information about the telepathy-commits
mailing list