[telepathy-gabble/master] make more use of constants.py in tests

Dafydd Harries daf at rhydd.org
Wed Apr 8 11:00:49 PDT 2009


Also other small cleanups.
---
 tests/twisted/constants.py                         |   14 +++-
 tests/twisted/jingle/google-relay.py               |   18 ++---
 tests/twisted/jingle/hold-audio.py                 |    1 -
 tests/twisted/jingle/hold-av.py                    |    1 -
 tests/twisted/jingle/payload-types.py              |    6 +-
 tests/twisted/jingle/stun-server.py                |    3 +-
 .../twisted/jingle/test-content-adding-removal.py  |    6 +-
 tests/twisted/jingle/test-content-complex.py       |    2 +-
 tests/twisted/jingle/test-dialects-outgoing.py     |    6 +-
 tests/twisted/jingle/test-incoming-call.py         |    7 +-
 .../jingle/test-outgoing-call-deprecated.py        |    9 +--
 .../jingle/test-outgoing-call-deprecated2.py       |    8 +--
 tests/twisted/jingle/test-outgoing-call-ensure.py  |   78 ++++++++------------
 .../jingle/test-outgoing-call-requestotron.py      |   50 +++++--------
 tests/twisted/jingle/test-outgoing-call.py         |   49 +++++--------
 tests/twisted/muc/send-error.py                    |    6 +-
 tests/twisted/muc/test-ensure.py                   |   29 +++----
 tests/twisted/muc/test-muc-invitation.py           |    9 +-
 tests/twisted/muc/test-muc-ownership.py            |   34 +++-----
 tests/twisted/muc/test-muc-properties.py           |    4 +-
 tests/twisted/muc/test-muc.py                      |   31 +++-----
 tests/twisted/olpc/gadget-invite.py                |    7 +-
 tests/twisted/olpc/gadget-restarted.py             |    3 +-
 tests/twisted/olpc/olpc-activity-search.py         |   29 +++----
 tests/twisted/olpc/olpc-buddy-search.py            |   19 ++---
 tests/twisted/olpc/olpc-muc-invitation.py          |    9 +-
 tests/twisted/olpc/olpc-muc-prop-change.py         |    7 +-
 tests/twisted/olpc/util.py                         |    7 +-
 tests/twisted/olpc/view-presence.py                |    5 +-
 tests/twisted/roster/ensure.py                     |   26 +++----
 tests/twisted/roster/groups-12791.py               |   24 ++----
 tests/twisted/roster/groups.py                     |   27 +++----
 tests/twisted/roster/request-group-after-roster.py |   20 ++---
 .../twisted/roster/request-group-before-roster.py  |   12 +--
 tests/twisted/roster/test-google-roster.py         |    6 +-
 tests/twisted/roster/test-roster-item-deletion.py  |    7 +-
 tests/twisted/roster/test-roster-subscribe.py      |    6 +-
 tests/twisted/roster/test-roster.py                |   25 +++----
 tests/twisted/roster/test-save-alias-to-roster.py  |    6 +-
 tests/twisted/test-capabilities.py                 |   33 ++++----
 tests/twisted/test-caps-cache.py                   |    9 +--
 tests/twisted/test-caps-hash.py                    |   21 ++---
 tests/twisted/text/destroy.py                      |   45 ++++-------
 tests/twisted/text/ensure.py                       |   62 ++++++----------
 tests/twisted/text/initiate-requestotron.py        |   53 +++++---------
 tests/twisted/text/initiate.py                     |   18 ++---
 tests/twisted/text/respawn.py                      |   57 ++++++---------
 tests/twisted/text/send-error.py                   |   40 +++-------
 tests/twisted/text/test-chat-state.py              |   18 ++---
 tests/twisted/text/test-text-delayed.py            |    8 +-
 tests/twisted/text/test-text-no-body.py            |    6 +-
 tests/twisted/text/test-text.py                    |   17 ++--
 tests/twisted/tubes/close-muc-with-closed-tube.py  |   23 +++---
 tests/twisted/tubes/crash-on-list-channels.py      |    9 +-
 .../twisted/tubes/create-invalid-tube-channels.py  |    7 +-
 tests/twisted/tubes/ensure-si-tube.py              |   29 +++----
 tests/twisted/tubes/request-invalid-dbus-tube.py   |    2 +-
 tests/twisted/tubes/test-get-available-tubes.py    |    6 +-
 58 files changed, 443 insertions(+), 636 deletions(-)

diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index 4ae3e93..d3c3d35 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -10,13 +10,20 @@ HT_CONTACT_LIST = 3
 HT_GROUP = 4
 
 CHANNEL = "org.freedesktop.Telepathy.Channel"
+
+CHANNEL_IFACE_CALL_STATE = CHANNEL + ".Interface.CallState"
+CHANNEL_IFACE_CHAT_STATE = CHANNEL + '.Interface.ChatState'
+CHANNEL_IFACE_DESTROYABLE = CHANNEL + ".Interface.Destroyable"
 CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
 CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold"
 CHANNEL_IFACE_MEDIA_SIGNALLING = CHANNEL + ".Interface.MediaSignalling"
-CHANNEL_IFACE_CALL_STATE = CHANNEL + ".Interface.CallState"
+CHANNEL_IFACE_MESSAGES = CHANNEL + ".Interface.Messages"
+CHANNEL_IFACE_PASSWORD = CHANNEL + ".Interface.Password"
+CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT"
+
+CHANNEL_TYPE_CONTACT_LIST = CHANNEL + ".Type.ContactList"
 CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text"
 CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
-CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT"
 CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube.DRAFT"
 CHANNEL_TYPE_DBUS_TUBE = CHANNEL + ".Type.DBusTube.DRAFT"
 CHANNEL_TYPE_STREAMED_MEDIA = CHANNEL + ".Type.StreamedMedia"
@@ -37,10 +44,13 @@ INITIATOR_ID = CHANNEL + '.InitiatorID'
 INTERFACES = CHANNEL + '.Interfaces'
 
 CONN = "org.freedesktop.Telepathy.Connection"
+CONN_IFACE_CAPS = CONN + '.Interface.Capabilities'
 CONN_IFACE_CONTACTS = CONN + '.Interface.Contacts'
 CONN_IFACE_CONTACT_CAPS = CONN + '.Interface.ContactCapabilities.DRAFT'
 CONN_IFACE_REQUESTS = CONN + '.Interface.Requests'
 
+STREAM_HANDLER = 'org.freedesktop.Telepathy.Media.StreamHandler'
+
 ERROR = 'org.freedesktop.Telepathy.Error'
 INVALID_ARGUMENT = ERROR + '.InvalidArgument'
 NOT_IMPLEMENTED = ERROR + '.NotImplemented'
diff --git a/tests/twisted/jingle/google-relay.py b/tests/twisted/jingle/google-relay.py
index a1400c5..8f4fb34 100644
--- a/tests/twisted/jingle/google-relay.py
+++ b/tests/twisted/jingle/google-relay.py
@@ -140,7 +140,7 @@ def test(q, bus, conn, stream, incoming=True, too_slow=False):
     # Force Gabble to process the capabilities
     sync_stream(q, stream)
 
-    remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
+    remote_handle = conn.RequestHandles(cs.HT_CONTACT, ["foo at bar.com/Foo"])[0]
 
     if incoming:
         # Remote end calls us
@@ -161,11 +161,9 @@ def test(q, bus, conn, stream, incoming=True, too_slow=False):
             'Channel.Interface.Group')
     else:
         call_async(q, conn.Requests, 'CreateChannel',
-                { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                    'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-                  'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-                  'org.freedesktop.Telepathy.Channel.TargetHandle':
-                    remote_handle,
+                { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+                  cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+                  cs.TARGET_HANDLE: remote_handle,
                   })
         ret, old_sig, new_sig = q.expect_many(
             EventPattern('dbus-return', method='CreateChannel'),
@@ -204,17 +202,15 @@ def test(q, bus, conn, stream, incoming=True, too_slow=False):
 
     # Exercise channel properties
     channel_props = media_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetHandle'] == remote_handle
-    assert channel_props['TargetHandleType'] == 1
+    assert channel_props['TargetHandleType'] == cs.HT_CONTACT
     assert channel_props['TargetID'] == 'foo at bar.com'
     assert channel_props['Requested'] == (not incoming)
 
     # The new API for STUN servers etc.
     sh_props = stream_handler.GetAll(
-            'org.freedesktop.Telepathy.Media.StreamHandler',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.STREAM_HANDLER, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert sh_props['NATTraversal'] == 'gtalk-p2p'
     assert sh_props['CreatedLocally'] == (not incoming)
diff --git a/tests/twisted/jingle/hold-audio.py b/tests/twisted/jingle/hold-audio.py
index 810d3fe..583afc4 100644
--- a/tests/twisted/jingle/hold-audio.py
+++ b/tests/twisted/jingle/hold-audio.py
@@ -16,7 +16,6 @@ def test(jp, q, bus, conn, stream):
 
     self_handle = conn.GetSelfHandle()
     handle = conn.RequestHandles(cs.HT_CONTACT, [remote_jid])[0]
-
     path = conn.RequestChannel(cs.CHANNEL_TYPE_STREAMED_MEDIA, cs.HT_CONTACT,
         handle, True)
 
diff --git a/tests/twisted/jingle/hold-av.py b/tests/twisted/jingle/hold-av.py
index e2bdc76..150c255 100644
--- a/tests/twisted/jingle/hold-av.py
+++ b/tests/twisted/jingle/hold-av.py
@@ -16,7 +16,6 @@ def test(jp, q, bus, conn, stream):
 
     self_handle = conn.GetSelfHandle()
     handle = conn.RequestHandles(cs.HT_CONTACT, [jt.peer])[0]
-
     path = conn.RequestChannel(cs.CHANNEL_TYPE_STREAMED_MEDIA,
         cs.HT_CONTACT, handle, True)
 
diff --git a/tests/twisted/jingle/payload-types.py b/tests/twisted/jingle/payload-types.py
index 2a0b05a..a9621d3 100644
--- a/tests/twisted/jingle/payload-types.py
+++ b/tests/twisted/jingle/payload-types.py
@@ -38,11 +38,9 @@ def test(q, bus, conn, stream):
     # Force Gabble to process the caps before calling RequestChannel
     sync_stream(q, stream)
 
-    handle = conn.RequestHandles(1, [jt.remote_jid])[0]
-
+    handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
     path = conn.RequestChannel(
-        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-        1, handle, True)
+        cs.CHANNEL_TYPE_STREAMED_MEDIA, cs.HT_CONTACT, handle, True)
 
     channel = bus.get_object(conn.bus_name, path)
     signalling_iface = make_channel_proxy(conn, path, 'Channel.Interface.MediaSignalling')
diff --git a/tests/twisted/jingle/stun-server.py b/tests/twisted/jingle/stun-server.py
index dad8724..b6c44fe 100644
--- a/tests/twisted/jingle/stun-server.py
+++ b/tests/twisted/jingle/stun-server.py
@@ -82,8 +82,7 @@ def test(q, bus, conn, stream,
 
     # Exercise channel properties
     channel_props = media_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetHandle'] == remote_handle
     assert channel_props['TargetHandleType'] == 1
     assert channel_props['TargetID'] == 'foo at bar.com'
diff --git a/tests/twisted/jingle/test-content-adding-removal.py b/tests/twisted/jingle/test-content-adding-removal.py
index 707a3c8..ff4cfb2 100644
--- a/tests/twisted/jingle/test-content-adding-removal.py
+++ b/tests/twisted/jingle/test-content-adding-removal.py
@@ -39,11 +39,9 @@ def test(q, bus, conn, stream):
     # Force Gabble to process the caps before calling RequestChannel
     sync_stream(q, stream)
 
-    handle = conn.RequestHandles(1, [jt.remote_jid])[0]
-
+    handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
     path = conn.RequestChannel(
-        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-        1, handle, True)
+        cs.CHANNEL_TYPE_STREAMED_MEDIA, cs.HT_CONTACT, handle, True)
 
     signalling_iface = make_channel_proxy(conn, path, 'Channel.Interface.MediaSignalling')
     media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
diff --git a/tests/twisted/jingle/test-content-complex.py b/tests/twisted/jingle/test-content-complex.py
index cd4ced6..f2b3f91 100644
--- a/tests/twisted/jingle/test-content-complex.py
+++ b/tests/twisted/jingle/test-content-complex.py
@@ -157,7 +157,7 @@ def worker(jp, q, bus, conn, stream):
 
     # Gabble removes the stream
     q.expect('dbus-signal', signal='StreamRemoved',
-        interface='org.freedesktop.Telepathy.Channel.Type.StreamedMedia')
+        interface=cs.CHANNEL_TYPE_STREAMED_MEDIA)
 
 
     # We try to make the request again, and succeed
diff --git a/tests/twisted/jingle/test-dialects-outgoing.py b/tests/twisted/jingle/test-dialects-outgoing.py
index 4639b1e..201fbce 100644
--- a/tests/twisted/jingle/test-dialects-outgoing.py
+++ b/tests/twisted/jingle/test-dialects-outgoing.py
@@ -15,10 +15,8 @@ def worker(jp, q, bus, conn, stream):
     jt2.prepare()
 
     remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
-
-    call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia', 0, 0, True)
-
+    call_async(
+        q, conn, 'RequestChannel', cs.CHANNEL_TYPE_STREAMED_MEDIA, 0, 0, True)
 
     ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
diff --git a/tests/twisted/jingle/test-incoming-call.py b/tests/twisted/jingle/test-incoming-call.py
index f473177..8d7d5cb 100644
--- a/tests/twisted/jingle/test-incoming-call.py
+++ b/tests/twisted/jingle/test-incoming-call.py
@@ -77,8 +77,7 @@ def test(q, bus, conn, stream):
 
     # Exercise channel properties
     channel_props = media_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetHandle'] == remote_handle
     assert channel_props['TargetHandleType'] == cs.HT_CONTACT
     assert media_chan.GetHandle(dbus_interface=cs.CHANNEL) == (cs.HT_CONTACT,
@@ -88,8 +87,8 @@ def test(q, bus, conn, stream):
     assert channel_props['InitiatorHandle'] == remote_handle
     assert channel_props['Requested'] == False
 
-    group_props = media_chan.GetAll(cs.CHANNEL_IFACE_GROUP,
-        dbus_interface=dbus.PROPERTIES_IFACE)
+    group_props = media_chan.GetAll(
+        cs.CHANNEL_IFACE_GROUP, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert group_props['SelfHandle'] == self_handle, \
         (group_props['SelfHandle'], self_handle)
diff --git a/tests/twisted/jingle/test-outgoing-call-deprecated.py b/tests/twisted/jingle/test-outgoing-call-deprecated.py
index 67649c2..3edb7fc 100644
--- a/tests/twisted/jingle/test-outgoing-call-deprecated.py
+++ b/tests/twisted/jingle/test-outgoing-call-deprecated.py
@@ -39,19 +39,16 @@ def test(q, bus, conn, stream):
     # Force Gabble to process the caps before calling RequestChannel
     sync_stream(q, stream)
 
-    handle = conn.RequestHandles(1, [jt.remote_jid])[0]
-
+    handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
     path = conn.RequestChannel(
-        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-        1, handle, True)
+        cs.CHANNEL_TYPE_STREAMED_MEDIA, cs.HT_CONTACT, handle, True)
 
     signalling_iface = make_channel_proxy(conn, path, 'Channel.Interface.MediaSignalling')
     media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
     group_iface = make_channel_proxy(conn, path, 'Channel.Interface.Group')
 
     channel_props = group_iface.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetHandleType'] == cs.HT_CONTACT, channel_props
     assert channel_props['TargetHandle'] == handle, channel_props
     assert media_iface.GetHandle(dbus_interface=cs.CHANNEL) == (cs.HT_CONTACT,
diff --git a/tests/twisted/jingle/test-outgoing-call-deprecated2.py b/tests/twisted/jingle/test-outgoing-call-deprecated2.py
index 6b245b3..eb81cb9 100644
--- a/tests/twisted/jingle/test-outgoing-call-deprecated2.py
+++ b/tests/twisted/jingle/test-outgoing-call-deprecated2.py
@@ -40,18 +40,14 @@ def test(q, bus, conn, stream):
     sync_stream(q, stream)
 
     handle = conn.RequestHandles(1, [jt.remote_jid])[0]
-
-    path = conn.RequestChannel(
-        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-        0, 0, True)
+    path = conn.RequestChannel(cs.CHANNEL_TYPE_STREAMED_MEDIA, 0, 0, True)
 
     signalling_iface = make_channel_proxy(conn, path, 'Channel.Interface.MediaSignalling')
     media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
     group_iface = make_channel_proxy(conn, path, 'Channel.Interface.Group')
 
     channel_props = group_iface.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert media_iface.GetHandle(dbus_interface=cs.CHANNEL) == (0, 0)
     assert channel_props['TargetHandleType'] == 0, channel_props
     assert channel_props['TargetHandle'] == 0, channel_props
diff --git a/tests/twisted/jingle/test-outgoing-call-ensure.py b/tests/twisted/jingle/test-outgoing-call-ensure.py
index afedcc5..8a5b0a3 100644
--- a/tests/twisted/jingle/test-outgoing-call-ensure.py
+++ b/tests/twisted/jingle/test-outgoing-call-ensure.py
@@ -6,6 +6,7 @@ using EnsureChannel.
 
 from gabbletest import exec_test, sync_stream
 from servicetest import make_channel_proxy, call_async, EventPattern
+import constants as cs
 import jingletest
 
 
@@ -43,10 +44,9 @@ def test(q, bus, conn, stream):
 
     # Ensure a channel that doesn't exist yet.
     call_async(q, conn.Requests, 'EnsureChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: handle,
               })
 
     ret, old_sig, new_sig = q.expect_many(
@@ -64,9 +64,8 @@ def test(q, bus, conn, stream):
     sig_path, sig_ct, sig_ht, sig_h, sig_sh = old_sig.args
 
     assert sig_path == path, (sig_path, path)
-    assert sig_ct == u'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',\
-            sig_ct
-    assert sig_ht == 1, sig_ht      # HandleType = Contact
+    assert sig_ct == cs.CHANNEL_TYPE_STREAMED_MEDIA, sig_ct
+    assert sig_ht == cs.HT_CONTACT, sig_ht
     assert sig_h == handle, sig_h
     assert sig_sh == True           # suppress handler
 
@@ -76,29 +75,20 @@ def test(q, bus, conn, stream):
     assert new_sig.args[0][0][0] == path
     emitted_props = new_sig.args[0][0][1]
 
-    assert emitted_props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 1        # Contact
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetID'] ==\
-            'foo at bar.com', emitted_props
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'Requested'] == True
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorHandle'] == self_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorID'] == 'test at localhost'
-
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAMED_MEDIA
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
+    assert emitted_props[cs.TARGET_HANDLE] == handle
+    assert emitted_props[cs.TARGET_ID] == 'foo at bar.com', emitted_props
+    assert emitted_props[cs.REQUESTED] == True
+    assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
+    assert emitted_props[cs.INITIATOR_ID] == 'test at localhost'
 
     # Now ensure a media channel with the same contact, and check it's the
     # same.
     call_async(q, conn.Requests, 'EnsureChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: handle,
               })
 
     event = q.expect('dbus-return', method='EnsureChannel')
@@ -118,8 +108,8 @@ def test(q, bus, conn, stream):
     # Now, create an anonymous channel with RequestChannel, add the other
     # person to it with RequestStreams, then Ensure a media channel with that
     # person.  We should get the anonymous channel back.
-    call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia', 0, 0, True)
+    call_async(
+        q, conn, 'RequestChannel', cs.CHANNEL_TYPE_STREAMED_MEDIA, 0, 0, True)
 
     ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
@@ -129,8 +119,7 @@ def test(q, bus, conn, stream):
 
     path = ret.value[0]
     assert old_sig.args[0] == path, (old_sig.args[0], path)
-    assert old_sig.args[1] == u'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',\
-            old_sig.args[1]
+    assert old_sig.args[1] == cs.CHANNEL_TYPE_STREAMED_MEDIA, old_sig.args[1]
     assert old_sig.args[2] == 0, old_sig.args[2]
     assert old_sig.args[3] == 0, old_sig.args[3]
     assert old_sig.args[4] == True      # suppress handler
@@ -141,34 +130,27 @@ def test(q, bus, conn, stream):
     assert new_sig.args[0][0][0] == path
     emitted_props = new_sig.args[0][0][1]
 
-    assert emitted_props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 0
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            0
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetID'] == ''
-    assert emitted_props['org.freedesktop.Telepathy.Channel.Requested']\
-            == True
-    assert emitted_props['org.freedesktop.Telepathy.Channel.InitiatorHandle']\
-            == self_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.InitiatorID'] \
-            == 'test at localhost'
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAMED_MEDIA
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == 0
+    assert emitted_props[cs.TARGET_HANDLE] == 0
+    assert emitted_props[cs.TARGET_ID] == ''
+    assert emitted_props[cs.REQUESTED] == True
+    assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
+    assert emitted_props[cs.INITIATOR_ID] == 'test at localhost'
 
     media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
 
     # Request streams with the other person.  This should make them the
     # channel's "peer" property.
-    media_iface.RequestStreams(handle, [0]) # 0 == MEDIA_STREAM_TYPE_AUDIO
+    media_iface.RequestStreams(handle, [cs.MEDIA_STREAM_TYPE_AUDIO])
 
     # Now, Ensuring a media channel with handle should yield the channel just
     # created.
 
     call_async(q, conn.Requests, 'EnsureChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: handle,
               })
 
     event = q.expect('dbus-return', method='EnsureChannel')
diff --git a/tests/twisted/jingle/test-outgoing-call-requestotron.py b/tests/twisted/jingle/test-outgoing-call-requestotron.py
index d438fb3..c6d04a2 100644
--- a/tests/twisted/jingle/test-outgoing-call-requestotron.py
+++ b/tests/twisted/jingle/test-outgoing-call-requestotron.py
@@ -46,10 +46,9 @@ def test(q, bus, conn, stream):
     handle = conn.RequestHandles(1, [jt.remote_jid])[0]
 
     call_async(q, conn.Requests, 'CreateChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: handle,
               })
 
     ret, old_sig, new_sig = q.expect_many(
@@ -63,8 +62,7 @@ def test(q, bus, conn, stream):
     sig_path, sig_ct, sig_ht, sig_h, sig_sh = old_sig.args
 
     assert sig_path == path, (sig_path, path)
-    assert sig_ct == u'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',\
-            sig_ct
+    assert sig_ct == cs.CHANNEL_TYPE_STREAMED_MEDIA, sig_ct
     assert sig_ht == 1, sig_ht      # HandleType = Contact
     assert sig_h == handle, sig_h
     assert sig_sh == True           # suppress handler
@@ -75,20 +73,13 @@ def test(q, bus, conn, stream):
     assert new_sig.args[0][0][0] == path
     emitted_props = new_sig.args[0][0][1]
 
-    assert emitted_props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 1        # Contact
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetID'] ==\
-            'foo at bar.com', emitted_props
-    assert emitted_props['org.freedesktop.Telepathy.Channel.Requested'] \
-            == True
-    assert emitted_props['org.freedesktop.Telepathy.Channel.InitiatorHandle'] \
-            == self_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.InitiatorID'] \
-            == 'test at localhost'
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAMED_MEDIA
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
+    assert emitted_props[cs.TARGET_HANDLE] == handle
+    assert emitted_props[cs.TARGET_ID] == 'foo at bar.com', emitted_props
+    assert emitted_props[cs.REQUESTED] == True
+    assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
+    assert emitted_props[cs.INITIATOR_ID] == 'test at localhost'
 
     signalling_iface = make_channel_proxy(conn, path, 'Channel.Interface.MediaSignalling')
     media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
@@ -96,8 +87,7 @@ def test(q, bus, conn, stream):
 
     # Exercise basic Channel Properties from spec 0.17.7
     channel_props = group_iface.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props.get('TargetHandle') == handle, \
             channel_props.get('TargetHandle')
     assert channel_props.get('TargetHandleType') == 1,\
@@ -105,18 +95,18 @@ def test(q, bus, conn, stream):
     assert media_iface.GetHandle(dbus_interface=cs.CHANNEL) == (cs.HT_CONTACT,
             handle)
     assert channel_props.get('ChannelType') == \
-            'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',\
+            cs.CHANNEL_TYPE_STREAMED_MEDIA,\
             channel_props.get('ChannelType')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Group' in \
+    assert cs.CHANNEL_IFACE_GROUP in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.MediaSignalling' in \
+    assert cs.CHANNEL_IFACE_MEDIA_SIGNALLING in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Properties' in \
+    assert cs.TP_AWKWARD_PROPERTIES in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Hold' in \
+    assert cs.CHANNEL_IFACE_HOLD in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
     assert channel_props['TargetID'] == 'foo at bar.com', channel_props
@@ -126,8 +116,7 @@ def test(q, bus, conn, stream):
 
     # Exercise Group Properties from spec 0.17.6 (in a basic way)
     group_props = group_iface.GetAll(
-            'org.freedesktop.Telepathy.Channel.Interface.Group',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL_IFACE_GROUP, dbus_interface=dbus.PROPERTIES_IFACE)
     assert 'HandleOwners' in group_props, group_props
     assert 'Members' in group_props, group_props
     assert 'LocalPendingMembers' in group_props, group_props
@@ -142,8 +131,7 @@ def test(q, bus, conn, stream):
     list_streams_result = media_iface.ListStreams()
     assert len(list_streams_result) == 0, list_streams_result
 
-    streams = media_iface.RequestStreams(handle,
-            [cs.MEDIA_STREAM_TYPE_AUDIO])
+    streams = media_iface.RequestStreams(handle, [cs.MEDIA_STREAM_TYPE_AUDIO])
 
     list_streams_result = media_iface.ListStreams()
     assert streams == list_streams_result, (streams, list_streams_result)
diff --git a/tests/twisted/jingle/test-outgoing-call.py b/tests/twisted/jingle/test-outgoing-call.py
index 4b08979..491dfc5 100644
--- a/tests/twisted/jingle/test-outgoing-call.py
+++ b/tests/twisted/jingle/test-outgoing-call.py
@@ -45,8 +45,8 @@ def test(q, bus, conn, stream):
     self_handle = conn.GetSelfHandle()
     handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
 
-    call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia', 0, 0, True)
+    call_async(
+        q, conn, 'RequestChannel', cs.CHANNEL_TYPE_STREAMED_MEDIA, 0, 0, True)
 
     ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
@@ -56,8 +56,7 @@ def test(q, bus, conn, stream):
 
     path = ret.value[0]
     assert old_sig.args[0] == path, (old_sig.args[0], path)
-    assert old_sig.args[1] == u'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',\
-            old_sig.args[1]
+    assert old_sig.args[1] == cs.CHANNEL_TYPE_STREAMED_MEDIA, old_sig.args[1]
     assert old_sig.args[2] == 0, old_sig.args[2]
     assert old_sig.args[3] == 0, old_sig.args[3]
     assert old_sig.args[4] == True      # suppress handler
@@ -68,19 +67,13 @@ def test(q, bus, conn, stream):
     assert new_sig.args[0][0][0] == path
     emitted_props = new_sig.args[0][0][1]
 
-    assert emitted_props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 0
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            0
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetID'] == ''
-    assert emitted_props['org.freedesktop.Telepathy.Channel.Requested'] \
-            == True
-    assert emitted_props['org.freedesktop.Telepathy.Channel.InitiatorHandle'] \
-            == self_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.InitiatorID'] \
-            == 'test at localhost'
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAMED_MEDIA
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == 0
+    assert emitted_props[cs.TARGET_HANDLE] == 0
+    assert emitted_props[cs.TARGET_ID] == ''
+    assert emitted_props[cs.REQUESTED]  == True
+    assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
+    assert emitted_props[cs.INITIATOR_ID] == 'test at localhost'
 
     signalling_iface = make_channel_proxy(conn, path, 'Channel.Interface.MediaSignalling')
     media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
@@ -88,26 +81,25 @@ def test(q, bus, conn, stream):
 
     # Exercise basic Channel Properties from spec 0.17.7
     channel_props = group_iface.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props.get('TargetHandle') == 0, \
             channel_props.get('TargetHandle')
     assert channel_props.get('TargetHandleType') == 0,\
             channel_props.get('TargetHandleType')
     assert media_iface.GetHandle(dbus_interface=cs.CHANNEL) == (0, 0)
     assert channel_props.get('ChannelType') == \
-            'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',\
+            cs.CHANNEL_TYPE_STREAMED_MEDIA,\
             channel_props.get('ChannelType')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Group' in \
+    assert cs.CHANNEL_IFACE_GROUP in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.MediaSignalling' in \
+    assert cs.CHANNEL_IFACE_MEDIA_SIGNALLING in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Properties' in \
+    assert cs.TP_AWKWARD_PROPERTIES in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Hold' in \
+    assert cs.CHANNEL_IFACE_HOLD in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
     assert channel_props['TargetID'] == '', channel_props
@@ -117,8 +109,7 @@ def test(q, bus, conn, stream):
 
     # Exercise Group Properties from spec 0.17.6 (in a basic way)
     group_props = group_iface.GetAll(
-            'org.freedesktop.Telepathy.Channel.Interface.Group',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL_IFACE_GROUP, dbus_interface=dbus.PROPERTIES_IFACE)
     assert 'HandleOwners' in group_props, group_props
     assert 'Members' in group_props, group_props
     assert 'LocalPendingMembers' in group_props, group_props
@@ -128,8 +119,7 @@ def test(q, bus, conn, stream):
     list_streams_result = media_iface.ListStreams()
     assert len(list_streams_result) == 0, list_streams_result
 
-    streams = media_iface.RequestStreams(handle,
-            [cs.MEDIA_STREAM_TYPE_AUDIO])
+    streams = media_iface.RequestStreams(handle, [cs.MEDIA_STREAM_TYPE_AUDIO])
 
     list_streams_result = media_iface.ListStreams()
     assert streams == list_streams_result, (streams, list_streams_result)
@@ -162,8 +152,7 @@ def test(q, bus, conn, stream):
     stream_handler.StreamState(cs.MEDIA_STREAM_STATE_CONNECTED)
 
     sh_props = stream_handler.GetAll(
-            'org.freedesktop.Telepathy.Media.StreamHandler',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.STREAM_HANDLER, dbus_interface=dbus.PROPERTIES_IFACE)
     assert sh_props['NATTraversal'] == 'gtalk-p2p'
     assert sh_props['CreatedLocally'] == True
 
diff --git a/tests/twisted/muc/send-error.py b/tests/twisted/muc/send-error.py
index d78dce0..11670f0 100644
--- a/tests/twisted/muc/send-error.py
+++ b/tests/twisted/muc/send-error.py
@@ -6,6 +6,7 @@ import dbus
 
 from gabbletest import exec_test
 from servicetest import EventPattern
+import constants as cs
 import ns
 
 from mucutil import join_muc_and_check
@@ -28,9 +29,8 @@ def test(q, bus, conn, stream):
         }
     ]
 
-    sent_token = dbus.Interface(text_chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Messages'
-        ).SendMessage(greeting, dbus.UInt32(0))
+    sent_token = dbus.Interface(text_chan, cs.CHANNEL_IFACE_MESSAGES) \
+        .SendMessage(greeting, dbus.UInt32(0))
 
     stream_message, _, _ = q.expect_many(
         EventPattern('stream-message'),
diff --git a/tests/twisted/muc/test-ensure.py b/tests/twisted/muc/test-ensure.py
index 90ce9ce..6e55659 100644
--- a/tests/twisted/muc/test-ensure.py
+++ b/tests/twisted/muc/test-ensure.py
@@ -5,6 +5,7 @@ are several pending requests for the same MUC.
 
 from gabbletest import make_result_iq, exec_test, make_muc_presence
 from servicetest import call_async, EventPattern
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -40,16 +41,14 @@ def test(q, bus, conn, stream):
 def test_create_ensure(q, conn, bus, stream, room_jid, room_handle):
     # Call both Create and Ensure for the same channel.
     call_async(q, conn.Requests, 'CreateChannel',
-           { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 2,
-             'org.freedesktop.Telepathy.Channel.TargetHandle': room_handle,
+           { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+             cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
+             cs.TARGET_HANDLE: room_handle,
            })
     call_async(q, conn.Requests, 'EnsureChannel',
-           { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 2,
-             'org.freedesktop.Telepathy.Channel.TargetHandle': room_handle,
+           { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+             cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
+             cs.TARGET_HANDLE: room_handle,
            })
 
     mc, _ = q.expect_many(
@@ -99,16 +98,14 @@ def test_create_ensure(q, conn, bus, stream, room_jid, room_handle):
 def test_ensure_ensure(q, conn, bus, stream, room_jid, room_handle):
     # Call Ensure twice for the same channel.
     call_async(q, conn.Requests, 'EnsureChannel',
-           { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 2,
-             'org.freedesktop.Telepathy.Channel.TargetHandle': room_handle,
+           { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+             cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
+             cs.TARGET_HANDLE: room_handle,
            })
     call_async(q, conn.Requests, 'EnsureChannel',
-           { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 2,
-             'org.freedesktop.Telepathy.Channel.TargetHandle': room_handle,
+           { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+             cs.TARGET_HANDLE_TYPE: cs.HT_ROOM,
+             cs.TARGET_HANDLE: room_handle,
            })
 
     mc, _ = q.expect_many(
diff --git a/tests/twisted/muc/test-muc-invitation.py b/tests/twisted/muc/test-muc-invitation.py
index 057d2de..847f6ca 100644
--- a/tests/twisted/muc/test-muc-invitation.py
+++ b/tests/twisted/muc/test-muc-invitation.py
@@ -8,6 +8,7 @@ from twisted.words.xish import domish, xpath
 
 from gabbletest import exec_test, make_muc_presence
 from servicetest import call_async, EventPattern
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -27,15 +28,14 @@ def test(q, bus, conn, stream):
     stream.send(message)
 
     event = q.expect('dbus-signal', signal='NewChannel')
-    assert event.args[1] == 'org.freedesktop.Telepathy.Channel.Type.Text'
+    assert event.args[1] == cs.CHANNEL_TYPE_TEXT
 
     assert event.args[2] == 2   # handle type
     assert event.args[3] == 1   # handle
     room_handle = 1
 
     text_chan = bus.get_object(conn.bus_name, event.args[0])
-    group_iface = dbus.Interface(text_chan,
-        'org.freedesktop.Telepathy.Channel.Interface.Group')
+    group_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_GROUP)
 
     members = group_iface.GetMembers()
     local_pending = group_iface.GetLocalPendingMembers()
@@ -54,8 +54,7 @@ def test(q, bus, conn, stream):
     assert room_self_handle == local_pending[0]
 
     channel_props = text_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetID'] == 'chat at conf.localhost', channel_props
     assert channel_props['Requested'] == False
     assert channel_props['InitiatorID'] == 'bob at localhost'
diff --git a/tests/twisted/muc/test-muc-ownership.py b/tests/twisted/muc/test-muc-ownership.py
index 753ccbd..9b8b6ad 100644
--- a/tests/twisted/muc/test-muc-ownership.py
+++ b/tests/twisted/muc/test-muc-ownership.py
@@ -11,6 +11,7 @@ import dbus
 
 from gabbletest import make_result_iq, exec_test, make_muc_presence
 from servicetest import call_async, EventPattern
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -31,8 +32,8 @@ def test(q, bus, conn, stream):
     event = q.expect('dbus-return', method='RequestHandles')
     room_handle = event.value[0][0]
 
-    call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.Text', 2, room_handle, True)
+    call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_TEXT, cs.HT_ROOM,
+        room_handle, True)
 
     gfc, _, _ = q.expect_many(
         EventPattern('dbus-signal', signal='GroupFlagsChanged'),
@@ -71,35 +72,26 @@ def test(q, bus, conn, stream):
 
     event = q.expect('dbus-signal', signal='MembersChanged',
         args=[u'', [2, 3, 4, 5, 7], [], [], [], 0, 0])
-    assert conn.InspectHandles(1, [2]) == [
-        'chat at conf.localhost/test']
-    assert conn.InspectHandles(1, [3]) == [
-        'chat at conf.localhost/bob']
-    assert conn.InspectHandles(1, [4]) == [
-        'chat at conf.localhost/brian']
-    assert conn.InspectHandles(1, [5]) == [
-        'chat at conf.localhost/che']
-    assert conn.InspectHandles(1, [6]) == [
-        'che at foo.com']
-    assert conn.InspectHandles(1, [7]) == [
-        'chat at conf.localhost/chris']
-    assert conn.InspectHandles(1, [8]) == [
-        'chris at foo.com']
+    assert conn.InspectHandles(1, [2]) == ['chat at conf.localhost/test']
+    assert conn.InspectHandles(1, [3]) == ['chat at conf.localhost/bob']
+    assert conn.InspectHandles(1, [4]) == ['chat at conf.localhost/brian']
+    assert conn.InspectHandles(1, [5]) == ['chat at conf.localhost/che']
+    assert conn.InspectHandles(1, [6]) == ['che at foo.com']
+    assert conn.InspectHandles(1, [7]) == ['chat at conf.localhost/chris']
+    assert conn.InspectHandles(1, [8]) == ['chris at foo.com']
 
     event = q.expect('dbus-return', method='RequestChannel')
 
     bus = dbus.SessionBus()
     chan = bus.get_object(conn.bus_name, event.value[0])
-    group = dbus.Interface(chan,
-        'org.freedesktop.Telepathy.Channel.Interface.Group')
-    props = dbus.Interface(chan,
-        dbus.PROPERTIES_IFACE)
+    group = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
+    props = dbus.Interface(chan, dbus.PROPERTIES_IFACE)
 
     # Exercise GetHandleOwners
     assert group.GetHandleOwners([5, 7]) == [6, 8]
 
     # Exercise D-Bus properties
-    all = props.GetAll('org.freedesktop.Telepathy.Channel.Interface.Group')
+    all = props.GetAll(cs.CHANNEL_IFACE_GROUP)
 
     assert all[u'LocalPendingMembers'] == [], all
     assert all[u'Members'] == [2, 3, 4, 5, 7], all
diff --git a/tests/twisted/muc/test-muc-properties.py b/tests/twisted/muc/test-muc-properties.py
index f2eb394..755e654 100644
--- a/tests/twisted/muc/test-muc-properties.py
+++ b/tests/twisted/muc/test-muc-properties.py
@@ -10,7 +10,7 @@ from gabbletest import (
     request_muc_handle)
 from servicetest import call_async, wrap_channel, EventPattern
 
-import constants
+import constants as cs
 import ns
 
 def add_field(elem, type, var, value):
@@ -43,7 +43,7 @@ def test(q, bus, conn, stream):
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
     muc_handle = request_muc_handle(q, conn, stream, 'chat at conf.localhost')
 
-    call_async(q, conn, 'RequestChannel', constants.CHANNEL_TYPE_TEXT, 2,
+    call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_TEXT, cs.HT_ROOM,
         muc_handle, True)
 
     q.expect('stream-presence', to='chat at conf.localhost/test')
diff --git a/tests/twisted/muc/test-muc.py b/tests/twisted/muc/test-muc.py
index 196a77e..8426d00 100644
--- a/tests/twisted/muc/test-muc.py
+++ b/tests/twisted/muc/test-muc.py
@@ -9,6 +9,7 @@ from twisted.words.xish import domish
 
 from gabbletest import exec_test
 from servicetest import EventPattern
+import constants as cs
 
 from mucutil import join_muc_and_check
 
@@ -22,28 +23,27 @@ def test(q, bus, conn, stream):
 
     # Exercise basic Channel Properties from spec 0.17.7
     channel_props = text_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=cs.PROPERTIES_IFACE)
     assert channel_props.get('TargetHandle') == room_handle,\
             (channel_props.get('TargetHandle'), room_handle)
-    assert channel_props.get('TargetHandleType') == 2,\
+    assert channel_props.get('TargetHandleType') == cs.HT_ROOM,\
             channel_props.get('TargetHandleType')
     assert channel_props.get('ChannelType') == \
-            'org.freedesktop.Telepathy.Channel.Type.Text',\
+            cs.CHANNEL_TYPE_TEXT,\
             channel_props.get('ChannelType')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Group' in \
+    assert cs.CHANNEL_IFACE_GROUP in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Password' in \
+    assert cs.CHANNEL_IFACE_PASSWORD in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Properties' in \
+    assert cs.TP_AWKWARD_PROPERTIES in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.ChatState' in \
+    assert cs.CHANNEL_IFACE_CHAT_STATE in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Messages' in \
+    assert cs.CHANNEL_IFACE_MESSAGES in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
     assert channel_props['TargetID'] == 'chat at conf.localhost', channel_props
@@ -53,8 +53,7 @@ def test(q, bus, conn, stream):
 
     # Exercise Group Properties from spec 0.17.6 (in a basic way)
     group_props = text_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel.Interface.Group',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL_IFACE_GROUP, dbus_interface=cs.PROPERTIES_IFACE)
     assert 'HandleOwners' in group_props, group_props
     assert 'Members' in group_props, group_props
     assert 'LocalPendingMembers' in group_props, group_props
@@ -104,8 +103,7 @@ def test(q, bus, conn, stream):
     # PendingMessagesRemoved fires.
     message_id = header['pending-message-id']
 
-    dbus.Interface(text_chan,
-        u'org.freedesktop.Telepathy.Channel.Type.Text'
+    dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT
         ).AcknowledgePendingMessages([message_id])
 
     removed = q.expect('dbus-signal', signal='PendingMessagesRemoved')
@@ -125,8 +123,7 @@ def test(q, bus, conn, stream):
     ]
 
     sent_token = dbus.Interface(text_chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Messages'
-        ).SendMessage(greeting, dbus.UInt32(0))
+        cs.CHANNEL_IFACE_MESSAGES).SendMessage(greeting, dbus.UInt32(0))
 
     assert sent_token
 
@@ -206,9 +203,7 @@ def test(q, bus, conn, stream):
 
 
     # Send a normal message using the Channel.Type.Text API
-    dbus.Interface(text_chan,
-            'org.freedesktop.Telepathy.Channel.Type.Text').Send(0, 'goodbye')
-
+    dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT).Send(0, 'goodbye')
 
     event, sent, message_sent = q.expect_many(
         EventPattern('stream-message'),
diff --git a/tests/twisted/olpc/gadget-invite.py b/tests/twisted/olpc/gadget-invite.py
index 59152eb..db54ebf 100644
--- a/tests/twisted/olpc/gadget-invite.py
+++ b/tests/twisted/olpc/gadget-invite.py
@@ -7,6 +7,7 @@ import dbus
 from servicetest import call_async, EventPattern
 from gabbletest import exec_test, make_result_iq, acknowledge_iq, sync_stream,\
     make_muc_presence
+import constants as cs
 
 from twisted.words.xish import xpath
 
@@ -14,7 +15,7 @@ from util import announce_gadget, gadget_publish
 import ns
 
 def join_channel(name, q, conn, stream):
-    call_async(q, conn, 'RequestHandles', 2, [name])
+    call_async(q, conn, 'RequestHandles', cs.HT_ROOM, [name])
 
     # announce conference service
     event = q.expect('stream-iq', to='conference.localhost', query_ns=ns.DISCO_INFO)
@@ -26,8 +27,8 @@ def join_channel(name, q, conn, stream):
     event = q.expect('dbus-return', method='RequestHandles')
     handles = event.value[0]
 
-    call_async(q, conn, 'RequestChannel',
-            'org.freedesktop.Telepathy.Channel.Type.Text', 2, handles[0], True)
+    call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_TEXT, cs.HT_ROOM,
+        handles[0], True)
 
     event = q.expect('stream-presence', to='myroom at conference.localhost/test')
     # Send presence for own membership of room.
diff --git a/tests/twisted/olpc/gadget-restarted.py b/tests/twisted/olpc/gadget-restarted.py
index e9fc979..603823a 100644
--- a/tests/twisted/olpc/gadget-restarted.py
+++ b/tests/twisted/olpc/gadget-restarted.py
@@ -6,6 +6,7 @@ import dbus
 
 from servicetest import EventPattern
 from gabbletest import exec_test, acknowledge_iq, sync_stream
+import constants as cs
 
 from util import announce_gadget, request_random_activity_view, elem
 import ns
@@ -45,7 +46,7 @@ def test(q, bus, conn, stream):
     presence = elem('presence', from_='gadget.localhost', to='test at localhost')
     stream.send(presence)
 
-    q.expect('dbus-signal', signal='Closed', interface='org.freedesktop.Telepathy.Channel')
+    q.expect('dbus-signal', signal='Closed', interface=cs.CHANNEL)
 
 if __name__ == '__main__':
     exec_test(test)
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index cad8f4b..659bc7a 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -46,11 +46,11 @@ def test(q, bus, conn, stream):
             'org.laptop.Telepathy.ActivityProperties')
     buddy_prop_iface = dbus.Interface(conn, 'org.laptop.Telepathy.BuddyInfo')
     gadget_iface = dbus.Interface(conn, 'org.laptop.Telepathy.Gadget')
-    requests_iface = dbus.Interface(conn, tp_name_prefix + '.Connection.Interface.Requests')
+    requests_iface = dbus.Interface(conn, cs.CONN_IFACE_REQUESTS)
 
     # Gadget was not announced yet
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.ActivityView',
             'org.laptop.Telepathy.Channel.Interface.View.MaxSize': 5,
           })
@@ -61,10 +61,9 @@ def test(q, bus, conn, stream):
 
     # check if we can request Activity views
     properties = conn.GetAll(
-        'org.freedesktop.Telepathy.Connection.Interface.Requests',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
 
-    assert ({tp_name_prefix + '.Channel.ChannelType':
+    assert ({cs.CHANNEL_TYPE:
             olpc_name_prefix + '.Channel.Type.ActivityView'},
 
             [olpc_name_prefix + '.Channel.Interface.View.MaxSize',
@@ -83,9 +82,7 @@ def test(q, bus, conn, stream):
     view1 = bus.get_object(conn.bus_name, view_path)
 
     # check org.freedesktop.Telepathy.Channel D-Bus properties
-    props = view1.GetAll(
-        'org.freedesktop.Telepathy.Channel',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+    props = view1.GetAll(cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert props['ChannelType'] == 'org.laptop.Telepathy.Channel.Type.ActivityView'
     assert 'org.laptop.Telepathy.Channel.Interface.View' in props['Interfaces']
@@ -108,7 +105,7 @@ def test(q, bus, conn, stream):
     assert props['Properties'] == {}
     assert props['Participants'] == []
 
-    assert view1.GetChannelType(dbus_interface='org.freedesktop.Telepathy.Channel') ==\
+    assert view1.GetChannelType(dbus_interface=cs.CHANNEL) ==\
             'org.laptop.Telepathy.Channel.Type.ActivityView'
 
     ## Current views ##
@@ -167,7 +164,7 @@ def test(q, bus, conn, stream):
     props = dbus.Dictionary({'color': '#AABBCC,#001122'}, signature='sv')
 
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.ActivityView',
             'org.laptop.Telepathy.Channel.Interface.View.MaxSize': 5,
             'org.laptop.Telepathy.Channel.Type.ActivityView.Properties': props,
@@ -214,20 +211,18 @@ def test(q, bus, conn, stream):
             args=[[('activity2', handles['room2'])], []])
 
     act = view2.Get(olpc_name_prefix + '.Channel.Interface.View',
-        'Activities',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+        'Activities', dbus_interface=dbus.PROPERTIES_IFACE)
     assert sorted(act) == [('activity2', handles['room2'])]
 
     buddies = view2.Get(olpc_name_prefix + '.Channel.Interface.View',
-        'Buddies',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+        'Buddies', dbus_interface=dbus.PROPERTIES_IFACE)
     assert buddies == []
 
     # activity search by participants (view 3)
     participants = conn.RequestHandles(1, ["alice at localhost", "bob at localhost"])
 
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.ActivityView',
             'org.laptop.Telepathy.Channel.Interface.View.MaxSize': 5,
             'org.laptop.Telepathy.Channel.Type.ActivityView.Participants': participants,
@@ -502,7 +497,7 @@ def test(q, bus, conn, stream):
 
     # View request without MaxSize property
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.ActivityView',
           })
 
@@ -514,7 +509,7 @@ def test(q, bus, conn, stream):
     participants = conn.RequestHandles(1, ["alice at localhost", "bob at localhost"])
 
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.ActivityView',
             'org.laptop.Telepathy.Channel.Interface.View.MaxSize': 5,
             'org.laptop.Telepathy.Channel.Type.ActivityView.Properties': props,
diff --git a/tests/twisted/olpc/olpc-buddy-search.py b/tests/twisted/olpc/olpc-buddy-search.py
index 36808b1..a2c8e71 100644
--- a/tests/twisted/olpc/olpc-buddy-search.py
+++ b/tests/twisted/olpc/olpc-buddy-search.py
@@ -35,7 +35,7 @@ def test(q, bus, conn, stream):
 
     # Gadget was not announced yet
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.BuddyView',
             'org.laptop.Telepathy.Channel.Interface.View.MaxSize': 5,
           })
@@ -89,8 +89,7 @@ def test(q, bus, conn, stream):
 
     # check if we can request Buddy views
     properties = conn.GetAll(
-        'org.freedesktop.Telepathy.Connection.Interface.Requests',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert ({tp_name_prefix + '.Channel.ChannelType':
             olpc_name_prefix + '.Channel.Type.BuddyView'},
@@ -155,9 +154,7 @@ def test(q, bus, conn, stream):
     assert props['org.laptop.Telepathy.Channel.Type.BuddyView.Alias'] == ''
 
     # check org.freedesktop.Telepathy.Channel D-Bus properties
-    props = view1.GetAll(
-        'org.freedesktop.Telepathy.Channel',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+    props = view1.GetAll(cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert props['ChannelType'] == 'org.laptop.Telepathy.Channel.Type.BuddyView'
     assert 'org.laptop.Telepathy.Channel.Interface.View' in props['Interfaces']
@@ -180,7 +177,7 @@ def test(q, bus, conn, stream):
     assert props['Properties'] == {}
     assert props['Alias'] == ''
 
-    assert view1.GetChannelType(dbus_interface='org.freedesktop.Telepathy.Channel') ==\
+    assert view1.GetChannelType(dbus_interface=cs.CHANNEL) ==\
             'org.laptop.Telepathy.Channel.Type.BuddyView'
 
     event = q.expect('dbus-signal', signal='BuddiesChanged')
@@ -300,8 +297,7 @@ def test(q, bus, conn, stream):
     assert conn.InspectHandles(1, added)[0] == 'oscar at localhost'
 
     members = view1.Get(olpc_name_prefix + '.Channel.Interface.View',
-        'Buddies',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+        'Buddies', dbus_interface=dbus.PROPERTIES_IFACE)
 
     members = sorted(conn.InspectHandles(1, members))
     assert sorted(members) == ['bob at localhost', 'charles at localhost',
@@ -325,8 +321,7 @@ def test(q, bus, conn, stream):
     assert conn.InspectHandles(1, [handle])[0] == 'bob at localhost'
 
     members = view1.Get(olpc_name_prefix + '.Channel.Interface.View',
-        'Buddies',
-        dbus_interface=dbus.PROPERTIES_IFACE)
+        'Buddies', dbus_interface=dbus.PROPERTIES_IFACE)
     members = sorted(conn.InspectHandles(1, members))
     assert sorted(members) == ['charles at localhost', 'oscar at localhost']
 
@@ -393,7 +388,7 @@ def test(q, bus, conn, stream):
 
     # View request without MaxSize property
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.BuddyView',
           })
 
diff --git a/tests/twisted/olpc/olpc-muc-invitation.py b/tests/twisted/olpc/olpc-muc-invitation.py
index c8c0148..c3a058a 100644
--- a/tests/twisted/olpc/olpc-muc-invitation.py
+++ b/tests/twisted/olpc/olpc-muc-invitation.py
@@ -8,6 +8,7 @@ from twisted.words.xish import domish, xpath
 
 from gabbletest import exec_test, make_muc_presence
 from servicetest import call_async, EventPattern
+import constants as cs
 import ns
 
 def test(q, bus, conn, stream):
@@ -37,8 +38,7 @@ def test(q, bus, conn, stream):
     message = domish.Element(('jabber:client', 'message'))
     message['from'] = 'bob at localhost'
     message['to'] = 'test at localhost'
-    properties = message.addElement(
-        (ns.OLPC_ACTIVITY_PROPS, 'properties'))
+    properties = message.addElement((ns.OLPC_ACTIVITY_PROPS, 'properties'))
     properties['room'] = 'chat at conf.localhost'
     properties['activity'] = 'foo_id'
     property = properties.addElement((None, 'property'))
@@ -78,14 +78,13 @@ def test(q, bus, conn, stream):
     stream.send(message)
 
     event = q.expect('dbus-signal', signal='NewChannel')
-    assert event.args[1] == 'org.freedesktop.Telepathy.Channel.Type.Text'
+    assert event.args[1] == cs.CHANNEL_TYPE_TEXT
 
     assert event.args[2] == 2   # handle type
     assert event.args[3] == handles['chat']   # handle
 
     text_chan = bus.get_object(conn.bus_name, event.args[0])
-    group_iface = dbus.Interface(text_chan,
-            'org.freedesktop.Telepathy.Channel.Interface.Group')
+    group_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_GROUP)
 
     members = group_iface.GetAllMembers()[0]
     local_pending = group_iface.GetAllMembers()[1]
diff --git a/tests/twisted/olpc/olpc-muc-prop-change.py b/tests/twisted/olpc/olpc-muc-prop-change.py
index 7347247..6250c6a 100644
--- a/tests/twisted/olpc/olpc-muc-prop-change.py
+++ b/tests/twisted/olpc/olpc-muc-prop-change.py
@@ -8,6 +8,7 @@ from twisted.words.xish import domish, xpath
 
 from gabbletest import exec_test, acknowledge_iq, make_muc_presence
 from servicetest import call_async, EventPattern
+import constants as cs
 import ns
 
 def test(q, bus, conn, stream):
@@ -56,15 +57,15 @@ def test(q, bus, conn, stream):
 
     event = q.expect('dbus-signal', signal='NewChannel')
 
-    assert event.args[1] == 'org.freedesktop.Telepathy.Channel.Type.Text'
+    assert event.args[1] == cs.CHANNEL_TYPE_TEXT
 
     assert event.args[2] == 2   # handle type
     assert event.args[3] == 1   # handle
     room_handle = 1
 
     text_chan = bus.get_object(conn.bus_name, event.args[0])
-    chan_iface = dbus.Interface(text_chan, 'org.freedesktop.Telepathy.Channel')
-    group_iface = dbus.Interface(text_chan, 'org.freedesktop.Telepathy.Channel.Interface.Group')
+    chan_iface = dbus.Interface(text_chan, cs.CHANNEL)
+    group_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_GROUP)
 
     members = group_iface.GetAllMembers()[0]
     local_pending = group_iface.GetAllMembers()[1]
diff --git a/tests/twisted/olpc/util.py b/tests/twisted/olpc/util.py
index c8c5f04..036965f 100644
--- a/tests/twisted/olpc/util.py
+++ b/tests/twisted/olpc/util.py
@@ -4,6 +4,7 @@ from servicetest import call_async, EventPattern
 from gabbletest import make_result_iq, elem, elem_iq
 from twisted.words.xish import domish, xpath
 from twisted.words.protocols.jabber.client import IQ
+import constants as cs
 import ns
 
 # Copied from Gadget
@@ -171,10 +172,10 @@ def send_reply_to_activity_view_request(stream, stanza, activities):
     stream.send(reply)
 
 def request_random_activity_view(q, stream, conn, max, id, activities):
-    requests_iface = dbus.Interface(conn, 'org.freedesktop.Telepathy.Connection.Interface.Requests')
+    requests_iface = dbus.Interface(conn, cs.CONN_IFACE_REQUESTS)
 
     call_async(q, requests_iface, 'CreateChannel',
-        { 'org.freedesktop.Telepathy.Channel.ChannelType':
+        { cs.CHANNEL_TYPE:
             'org.laptop.Telepathy.Channel.Type.ActivityView',
             'org.laptop.Telepathy.Channel.Interface.View.MaxSize': max
           })
@@ -199,7 +200,7 @@ def request_random_activity_view(q, stream, conn, max, id, activities):
     return return_event.value[0]
 
 def close_view(q, view, id):
-    chan_iface = dbus.Interface(view, 'org.freedesktop.Telepathy.Channel')
+    chan_iface = dbus.Interface(view, cs.CHANNEL)
     call_async(q, chan_iface, 'Close')
     event, _, _ = q.expect_many(
         EventPattern('stream-message', to='gadget.localhost'),
diff --git a/tests/twisted/olpc/view-presence.py b/tests/twisted/olpc/view-presence.py
index e6de383..fc80bf5 100644
--- a/tests/twisted/olpc/view-presence.py
+++ b/tests/twisted/olpc/view-presence.py
@@ -6,6 +6,7 @@ import dbus
 
 from servicetest import call_async, EventPattern
 from gabbletest import exec_test, make_result_iq, acknowledge_iq, sync_stream
+import constants as cs
 
 from twisted.words.xish import xpath
 
@@ -207,7 +208,7 @@ def test(q, bus, conn, stream):
     assert presence[handles['fred']] == (2, 'available', '')
 
     # close view 1
-    view1.Close(dbus_interface='org.freedesktop.Telepathy.Channel')
+    view1.Close(dbus_interface=cs.CHANNEL)
 
     # Eric's presence is changed as he's not in the view anymore
     event, _ = q.expect_many(
@@ -223,7 +224,7 @@ def test(q, bus, conn, stream):
     assert presence[handles['fred']] == (2, 'available', '')
 
     # close view 2
-    view2.Close(dbus_interface='org.freedesktop.Telepathy.Channel')
+    view2.Close(dbus_interface=cs.CHANNEL)
 
    # and now Fred is offline
     event, _ = q.expect_many(
diff --git a/tests/twisted/roster/ensure.py b/tests/twisted/roster/ensure.py
index 6e4c488..8b3b67e 100644
--- a/tests/twisted/roster/ensure.py
+++ b/tests/twisted/roster/ensure.py
@@ -22,16 +22,14 @@ def test(q, bus, conn, stream):
     stream.send(roster_event.stanza)
 
     call_async(q, conn.Requests, 'EnsureChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.ContactList',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': cs.HT_GROUP,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': test_handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
+              cs.TARGET_HANDLE_TYPE: cs.HT_GROUP,
+              cs.TARGET_HANDLE: test_handle,
               })
     call_async(q, conn.Requests, 'EnsureChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.ContactList',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': cs.HT_GROUP,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': test_handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
+              cs.TARGET_HANDLE_TYPE: cs.HT_GROUP,
+              cs.TARGET_HANDLE: test_handle,
               })
 
     ret = q.expect('dbus-return', method='EnsureChannel')
@@ -44,14 +42,10 @@ def test(q, bus, conn, stream):
     yours, path, props = ret.value
     yours2, path2, props2 = ret2.value
 
-    assert props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.ContactList', props
-    assert props['org.freedesktop.Telepathy.Channel.TargetHandleType'] ==\
-            cs.HT_GROUP, props
-    assert props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            test_handle, props
-    assert props['org.freedesktop.Telepathy.Channel.TargetID'] ==\
-            'test', props
+    assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_CONTACT_LIST, props
+    assert props[cs.TARGET_HANDLE_TYPE] == cs.HT_GROUP, props
+    assert props[cs.TARGET_HANDLE] == test_handle, props
+    assert props[cs.TARGET_ID] == 'test', props
 
     assert yours != yours2, (yours, yours2)
     assert path == path2, (path, path2)
diff --git a/tests/twisted/roster/groups-12791.py b/tests/twisted/roster/groups-12791.py
index 7c659f8..8736870 100644
--- a/tests/twisted/roster/groups-12791.py
+++ b/tests/twisted/roster/groups-12791.py
@@ -5,36 +5,30 @@ Test broken groups on the roster (regression test for fd.o #12791)
 import dbus
 
 from gabbletest import exec_test
-
-
-HT_CONTACT_LIST = 3
-HT_GROUP = 4
-
+import constants as cs
 
 def _expect_contact_list_channel(q, bus, conn, name, contacts):
     event = q.expect('dbus-signal', signal='NewChannel')
     path, type, handle_type, handle, suppress_handler = event.args
-    assert type == u'org.freedesktop.Telepathy.Channel.Type.ContactList', type
-    assert handle_type == HT_CONTACT_LIST, handle_type
+    assert type == cs.CHANNEL_TYPE_CONTACT_LIST, type
+    assert handle_type == cs.HT_CONTACT_LIST, handle_type
     inspected = conn.InspectHandles(handle_type, [handle])[0]
     assert inspected == name, (inspected, name)
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
-    inspected = conn.InspectHandles(1, group_iface.GetMembers())
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
+    inspected = conn.InspectHandles(cs.HT_CONTACT, group_iface.GetMembers())
     assert inspected == contacts, (inspected, contacts)
 
 def _expect_group_channel(q, bus, conn, name, contacts):
     event = q.expect('dbus-signal', signal='NewChannel')
     path, type, handle_type, handle, suppress_handler = event.args
-    assert type == u'org.freedesktop.Telepathy.Channel.Type.ContactList', type
-    assert handle_type == HT_GROUP, handle_type
+    assert type == cs.CHANNEL_TYPE_CONTACT_LIST, type
+    assert handle_type == cs.HT_GROUP, handle_type
     inspected = conn.InspectHandles(handle_type, [handle])[0]
     assert inspected == name, (inspected, name)
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
-    inspected = conn.InspectHandles(1, group_iface.GetMembers())
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
+    inspected = conn.InspectHandles(cs.HT_CONTACT, group_iface.GetMembers())
     assert inspected == contacts, (inspected, contacts)
 
 def test(q, bus, conn, stream):
diff --git a/tests/twisted/roster/groups.py b/tests/twisted/roster/groups.py
index d8f3cac..54a70a1 100644
--- a/tests/twisted/roster/groups.py
+++ b/tests/twisted/roster/groups.py
@@ -5,41 +5,34 @@ Test basic roster functionality.
 import dbus
 
 from gabbletest import exec_test
-
-
-HT_CONTACT_LIST = 3
-HT_GROUP = 4
-
+import constants as cs
 
 def _expect_contact_list_channel(q, bus, conn, name, contacts):
     event = q.expect('dbus-signal', signal='NewChannel')
     path, type, handle_type, handle, suppress_handler = event.args
-    assert type == u'org.freedesktop.Telepathy.Channel.Type.ContactList', type
-    assert handle_type == HT_CONTACT_LIST, handle_type
+    assert type == cs.CHANNEL_TYPE_CONTACT_LIST, type
+    assert handle_type == cs.HT_CONTACT_LIST, handle_type
     inspected = conn.InspectHandles(handle_type, [handle])[0]
     assert inspected == name, (inspected, name)
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
-    inspected = conn.InspectHandles(1, group_iface.GetMembers())
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
+    inspected = conn.InspectHandles(cs.HT_CONTACT, group_iface.GetMembers())
     assert inspected == contacts, (inspected, contacts)
 
 def _expect_group_channel(q, bus, conn, name, contacts):
     event = q.expect('dbus-signal', signal='NewChannel')
     path, type, handle_type, handle, suppress_handler = event.args
-    assert type == u'org.freedesktop.Telepathy.Channel.Type.ContactList', type
-    assert handle_type == HT_GROUP, handle_type
+    assert type == cs.CHANNEL_TYPE_CONTACT_LIST, type
+    assert handle_type == cs.HT_GROUP, handle_type
     inspected = conn.InspectHandles(handle_type, [handle])[0]
     assert inspected == name, (inspected, name)
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
-    inspected = conn.InspectHandles(1, group_iface.GetMembers())
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
+    inspected = conn.InspectHandles(cs.HT_CONTACT, group_iface.GetMembers())
     assert inspected == contacts, (inspected, contacts)
 
     channel_props = chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetID'] == name, channel_props
     assert channel_props['Requested'] == False
     assert channel_props['InitiatorID'] == ''
diff --git a/tests/twisted/roster/request-group-after-roster.py b/tests/twisted/roster/request-group-after-roster.py
index ba49b91..3bf4643 100644
--- a/tests/twisted/roster/request-group-after-roster.py
+++ b/tests/twisted/roster/request-group-after-roster.py
@@ -26,11 +26,9 @@ def test(q, bus, conn, stream):
     sync_dbus(bus, q, conn)
 
     call_async(q, conn.Requests, 'CreateChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.ContactList',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType':
-                 cs.HT_GROUP,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': test_handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CONTACT_LIST,
+              cs.TARGET_HANDLE_TYPE: cs.HT_GROUP,
+              cs.TARGET_HANDLE: test_handle,
               })
 
     event = q.expect('dbus-return', method='CreateChannel')
@@ -38,14 +36,10 @@ def test(q, bus, conn, stream):
 
     event = q.expect('dbus-signal', signal='NewChannels')
     path, props = event.args[0][0]
-    assert props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.ContactList', props
-    assert props['org.freedesktop.Telepathy.Channel.TargetHandleType'] ==\
-            cs.HT_GROUP, props
-    assert props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            test_handle, props
-    assert props['org.freedesktop.Telepathy.Channel.TargetID'] ==\
-            'test', props
+    assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_CONTACT_LIST, props
+    assert props[cs.TARGET_HANDLE_TYPE] == cs.HT_GROUP, props
+    assert props[cs.TARGET_HANDLE] == test_handle, props
+    assert props[cs.TARGET_ID] == 'test', props
 
     assert ret_path == path, (ret_path, path)
     assert ret_props == props, (ret_props, props)
diff --git a/tests/twisted/roster/request-group-before-roster.py b/tests/twisted/roster/request-group-before-roster.py
index fe3a8e0..74860ef 100644
--- a/tests/twisted/roster/request-group-before-roster.py
+++ b/tests/twisted/roster/request-group-before-roster.py
@@ -5,8 +5,7 @@ group channel if the roster hasn't been received at the time of the call.
 
 from gabbletest import exec_test, sync_stream
 from servicetest import sync_dbus, call_async
-
-HT_GROUP = 4
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -15,14 +14,13 @@ def test(q, bus, conn, stream):
     roster_event = q.expect('stream-iq', query_ns='jabber:iq:roster')
     roster_event.stanza['type'] = 'result'
 
-    call_async(q, conn, "RequestHandles", HT_GROUP, ['test'])
+    call_async(q, conn, "RequestHandles", cs.HT_GROUP, ['test'])
 
     event = q.expect('dbus-return', method='RequestHandles')
     test_handle = event.value[0][0]
 
-    call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.ContactList', HT_GROUP,
-        test_handle, True)
+    call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_CONTACT_LIST,
+        cs.HT_GROUP, test_handle, True)
 
     # A previous incarnation of this test --- written with the intention that
     # RequestChannel would be called before the roster was received, to expose
@@ -45,7 +43,7 @@ def test(q, bus, conn, stream):
         event = q.expect('dbus-signal', signal='NewChannel')
         assert event.args[0] == path, (event.args, path)
         _, type, handle_type, handle, suppress_handler = event.args
-        if handle_type == HT_GROUP and handle == test_handle:
+        if handle_type == cs.HT_GROUP and handle == test_handle:
             break
 
 if __name__ == '__main__':
diff --git a/tests/twisted/roster/test-google-roster.py b/tests/twisted/roster/test-google-roster.py
index b1b9248..b06162d 100644
--- a/tests/twisted/roster/test-google-roster.py
+++ b/tests/twisted/roster/test-google-roster.py
@@ -6,6 +6,7 @@ Test workarounds for gtalk
 import dbus
 
 from gabbletest import acknowledge_iq, exec_test
+import constants as cs
 
 from twisted.words.protocols.jabber.client import IQ
 from twisted.words.xish import domish
@@ -33,7 +34,7 @@ def test(q, bus, conn, stream):
         event = q.expect('dbus-signal', signal='NewChannel')
         path, type, handle_type, handle, suppress_handler = event.args
 
-        if type != u'org.freedesktop.Telepathy.Channel.Type.ContactList':
+        if type != cs.CHANNEL_TYPE_CONTACT_LIST:
             continue
 
         chan_name = conn.InspectHandles(handle_type, [handle])[0]
@@ -43,8 +44,7 @@ def test(q, bus, conn, stream):
 
     # request subscription
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
     assert group_iface.GetMembers() == []
     handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
     group_iface.AddMembers([handle], '')
diff --git a/tests/twisted/roster/test-roster-item-deletion.py b/tests/twisted/roster/test-roster-item-deletion.py
index 1add452..238c86f 100644
--- a/tests/twisted/roster/test-roster-item-deletion.py
+++ b/tests/twisted/roster/test-roster-item-deletion.py
@@ -5,8 +5,10 @@ Regression test for http://bugs.freedesktop.org/show_bug.cgi?id=19524
 import dbus
 
 from twisted.words.protocols.jabber.client import IQ
+
 from gabbletest import exec_test, acknowledge_iq
 from servicetest import EventPattern
+import constants as cs
 
 def _expect_contact_list_channel(q, bus, conn, name, contacts):
     old_signal, new_signal = q.expect_many(
@@ -16,11 +18,10 @@ def _expect_contact_list_channel(q, bus, conn, name, contacts):
 
     path, type, handle_type, handle, suppress_handler = old_signal.args
 
-    assert type == u'org.freedesktop.Telepathy.Channel.Type.ContactList'
+    assert type == cs.CHANNEL_TYPE_CONTACT_LIST
     assert conn.InspectHandles(handle_type, [handle])[0] == name
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
     members = group_iface.GetMembers()
     assert conn.InspectHandles(1, members) == contacts
 
diff --git a/tests/twisted/roster/test-roster-subscribe.py b/tests/twisted/roster/test-roster-subscribe.py
index cdba4e7..42525d6 100644
--- a/tests/twisted/roster/test-roster-subscribe.py
+++ b/tests/twisted/roster/test-roster-subscribe.py
@@ -9,6 +9,7 @@ from twisted.words.xish import domish
 
 from servicetest import EventPattern
 from gabbletest import acknowledge_iq, exec_test
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -22,7 +23,7 @@ def test(q, bus, conn, stream):
         event = q.expect('dbus-signal', signal='NewChannel')
         path, type, handle_type, handle, suppress_handler = event.args
 
-        if type != u'org.freedesktop.Telepathy.Channel.Type.ContactList':
+        if type != cs.CHANNEL_TYPE_CONTACT_LIST:
             continue
 
         chan_name = conn.InspectHandles(handle_type, [handle])[0]
@@ -32,8 +33,7 @@ def test(q, bus, conn, stream):
 
     # request subscription
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
     assert group_iface.GetMembers() == []
     handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
     group_iface.AddMembers([handle], '')
diff --git a/tests/twisted/roster/test-roster.py b/tests/twisted/roster/test-roster.py
index 4329588..937574b 100644
--- a/tests/twisted/roster/test-roster.py
+++ b/tests/twisted/roster/test-roster.py
@@ -5,7 +5,8 @@ Test basic roster functionality.
 import dbus
 
 from gabbletest import exec_test
-from servicetest import EventPattern, tp_name_prefix
+from servicetest import EventPattern
+import constants as cs
 
 def _expect_contact_list_channel(q, bus, conn, name, contacts):
     old_signal, new_signal = q.expect_many(
@@ -15,11 +16,10 @@ def _expect_contact_list_channel(q, bus, conn, name, contacts):
 
     path, type, handle_type, handle, suppress_handler = old_signal.args
 
-    assert type == u'org.freedesktop.Telepathy.Channel.Type.ContactList'
+    assert type == cs.CHANNEL_TYPE_CONTACT_LIST
     assert conn.InspectHandles(handle_type, [handle])[0] == name
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
     members = group_iface.GetMembers()
     assert conn.InspectHandles(1, members) == contacts
 
@@ -29,23 +29,21 @@ def _expect_contact_list_channel(q, bus, conn, name, contacts):
     assert new_signal.args[0][0][0] == path
 
     emitted_props = new_signal.args[0][0][1]
-    assert emitted_props[tp_name_prefix + '.Channel.ChannelType'] ==\
-            tp_name_prefix + '.Channel.Type.ContactList'
-    assert emitted_props[tp_name_prefix + '.Channel.TargetHandleType'] == 3
-    assert emitted_props[tp_name_prefix + '.Channel.TargetHandle'] == handle
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_CONTACT_LIST
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT_LIST
+    assert emitted_props[cs.TARGET_HANDLE] == handle
 
     # Exercise basic Channel Properties from spec 0.17.7
     channel_props = chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props.get('TargetHandle') == handle,\
             (channel_props.get('TargetHandle'), handle)
     assert channel_props.get('TargetHandleType') == 3,\
             channel_props.get('TargetHandleType')
     assert channel_props.get('ChannelType') == \
-            'org.freedesktop.Telepathy.Channel.Type.ContactList',\
+            cs.CHANNEL_TYPE_CONTACT_LIST,\
             channel_props.get('ChannelType')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Group' in \
+    assert cs.CHANNEL_IFACE_GROUP in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
     assert channel_props['TargetID'] == name, channel_props
@@ -55,8 +53,7 @@ def _expect_contact_list_channel(q, bus, conn, name, contacts):
 
     # Exercise Group Properties from spec 0.17.6 (in a basic way)
     group_props = chan.GetAll(
-            'org.freedesktop.Telepathy.Channel.Interface.Group',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL_IFACE_GROUP, dbus_interface=dbus.PROPERTIES_IFACE)
     assert 'HandleOwners' in group_props, group_props
     assert 'Members' in group_props, group_props
     assert group_props['Members'] == members, group_props['Members']
diff --git a/tests/twisted/roster/test-save-alias-to-roster.py b/tests/twisted/roster/test-save-alias-to-roster.py
index 34e0c85..d0a1e97 100644
--- a/tests/twisted/roster/test-save-alias-to-roster.py
+++ b/tests/twisted/roster/test-save-alias-to-roster.py
@@ -7,6 +7,7 @@ import dbus
 
 from servicetest import EventPattern, call_async
 from gabbletest import acknowledge_iq, exec_test, make_result_iq
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -23,7 +24,7 @@ def test(q, bus, conn, stream):
         event = q.expect('dbus-signal', signal='NewChannel')
         path, type, handle_type, handle, suppress_handler = event.args
 
-        if type != u'org.freedesktop.Telepathy.Channel.Type.ContactList':
+        if type != cs.CHANNEL_TYPE_CONTACT_LIST:
             continue
 
         chan_name = conn.InspectHandles(handle_type, [handle])[0]
@@ -33,8 +34,7 @@ def test(q, bus, conn, stream):
 
     # request subscription
     chan = bus.get_object(conn.bus_name, path)
-    group_iface = dbus.Interface(chan,
-        u'org.freedesktop.Telepathy.Channel.Interface.Group')
+    group_iface = dbus.Interface(chan, cs.CHANNEL_IFACE_GROUP)
     assert group_iface.GetMembers() == []
     handle = conn.RequestHandles(1, ['bob at foo.com'])[0]
     group_iface.AddMembers([handle], '')
diff --git a/tests/twisted/test-capabilities.py b/tests/twisted/test-capabilities.py
index 496c914..3bea957 100644
--- a/tests/twisted/test-capabilities.py
+++ b/tests/twisted/test-capabilities.py
@@ -7,12 +7,10 @@ import dbus
 
 from servicetest import EventPattern
 from gabbletest import exec_test, make_result_iq, make_presence
+import constants as cs
 
-text = 'org.freedesktop.Telepathy.Channel.Type.Text'
-sm = 'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
-icaps = 'org.freedesktop.Telepathy.Connection.Interface.Capabilities'
-icaps_attr  = icaps + "/caps"
-basic_caps = [(2, text, 3, 0)]
+icaps_attr  = cs.CONN_IFACE_CAPS + "/caps"
+basic_caps = [(2, cs.CHANNEL_TYPE_TEXT, 3, 0)]
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -29,10 +27,10 @@ def test(q, bus, conn, stream):
 
     # no special capabilities
     assert conn.Capabilities.GetCapabilities([2]) == basic_caps
-    assert conn.Contacts.GetContactAttributes([2], [icaps], False) == { 2L:
-        { icaps + "/caps": basic_caps,
-            'org.freedesktop.Telepathy.Connection/contact-id':
-            'bob at foo.com'}}
+    assert conn.Contacts.GetContactAttributes(
+        [2], [cs.CONN_IFACE_CAPS], False) == \
+        { 2L: { icaps_attr: basic_caps,
+                cs.CONN + '/contact-id': 'bob at foo.com'}}
 
     # send updated presence with Jingle audio/video caps info. we turn on both
     # audio and video at the same time to test that all of the capabilities are
@@ -75,14 +73,14 @@ def test(q, bus, conn, stream):
 
     # we can now do audio and video calls
     event = q.expect('dbus-signal', signal='CapabilitiesChanged',
-        args=[[(2, sm, 0, 3, 0, 3)]])
+        args=[[(2, cs.CHANNEL_TYPE_STREAMED_MEDIA, 0, 3, 0, 3)]])
 
-    caps = conn.Contacts.GetContactAttributes([2], [icaps], False)
+    caps = conn.Contacts.GetContactAttributes([2], [cs.CONN_IFACE_CAPS], False)
     assert caps.keys() == [2L]
     assert icaps_attr in caps[2L]
     assert len(caps[2L][icaps_attr]) == 2
     assert basic_caps[0] in caps[2L][icaps_attr]
-    assert (2, sm, 3, 3) in caps[2L][icaps_attr]
+    assert (2, cs.CHANNEL_TYPE_STREAMED_MEDIA, 3, 3) in caps[2L][icaps_attr]
 
     # send updated presence without video support
     presence = make_presence('bob at foo.com/Foo', status='hello')
@@ -93,14 +91,14 @@ def test(q, bus, conn, stream):
 
     # we can now do only audio calls
     event = q.expect('dbus-signal', signal='CapabilitiesChanged',
-        args=[[(2, sm, 3, 3, 3, 1)]])
+        args=[[(2, cs.CHANNEL_TYPE_STREAMED_MEDIA, 3, 3, 3, 1)]])
 
-    caps = conn.Contacts.GetContactAttributes([2], [icaps], False)
+    caps = conn.Contacts.GetContactAttributes([2], [cs.CONN_IFACE_CAPS], False)
     assert caps.keys() == [2L]
     assert icaps_attr in caps[2L]
     assert len(caps[2L][icaps_attr]) == 2
     assert basic_caps[0] in caps[2L][icaps_attr]
-    assert (2, sm, 3, 1) in caps[2L][icaps_attr]
+    assert (2, cs.CHANNEL_TYPE_STREAMED_MEDIA, 3, 1) in caps[2L][icaps_attr]
 
     # go offline
     presence = make_presence('bob at foo.com/Foo', type='unavailable')
@@ -108,10 +106,11 @@ def test(q, bus, conn, stream):
 
     # can't do audio calls any more
     event = q.expect('dbus-signal', signal='CapabilitiesChanged',
-        args=[[(2, sm, 3, 0, 1, 0)]])
+        args=[[(2, cs.CHANNEL_TYPE_STREAMED_MEDIA, 3, 0, 1, 0)]])
 
     # Contact went offline and the handle is now invalid
-    assert conn.Contacts.GetContactAttributes([2], [icaps], False) == {}
+    assert conn.Contacts.GetContactAttributes(
+        [2], [cs.CONN_IFACE_CAPS], False) == {}
 
     # regression test for fd.o #15198: getting caps of invalid handle crashed
     try:
diff --git a/tests/twisted/test-caps-cache.py b/tests/twisted/test-caps-cache.py
index 9ab0c04..93055c0 100644
--- a/tests/twisted/test-caps-cache.py
+++ b/tests/twisted/test-caps-cache.py
@@ -8,10 +8,7 @@ from twisted.words.xish import xpath
 
 from servicetest import EventPattern
 from gabbletest import exec_test, make_result_iq, make_presence
-
-text = 'org.freedesktop.Telepathy.Channel.Type.Text'
-sm = 'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
-caps_iface = 'org.freedesktop.Telepathy.Connection.Interface.Capabilities'
+import constants as cs
 
 def presence_add_caps(presence, ver, client, hash=None):
     c = presence.addElement(('http://jabber.org/protocol/caps', 'c'))
@@ -36,7 +33,7 @@ def _test_without_hash(q, bus, conn, stream, contact, contact_handle, client, di
 
 
     # no special capabilities
-    basic_caps = [(contact_handle, text, 3, 0)]
+    basic_caps = [(contact_handle, cs.CHANNEL_TYPE_TEXT, 3, 0)]
     assert conn.Capabilities.GetCapabilities([contact_handle]) == basic_caps
 
     # send updated presence with Jingle caps info
@@ -80,7 +77,7 @@ def _test_with_hash(q, bus, conn, stream, contact, contact_handle, client, disco
                (2, u'available', 'hello')}]))
 
     # no special capabilities
-    basic_caps = [(contact_handle, text, 3, 0)]
+    basic_caps = [(contact_handle, cs.CHANNEL_TYPE_TEXT, 3, 0)]
     assert conn.Capabilities.GetCapabilities([contact_handle]) == basic_caps
 
     # send updated presence with Jingle caps info
diff --git a/tests/twisted/test-caps-hash.py b/tests/twisted/test-caps-hash.py
index 9e2baae..b759090 100644
--- a/tests/twisted/test-caps-hash.py
+++ b/tests/twisted/test-caps-hash.py
@@ -26,12 +26,7 @@ from twisted.words.xish import xpath
 
 from gabbletest import exec_test, make_result_iq, make_presence
 from servicetest import sync_dbus, EventPattern
-
-gabble_service = 'org.freedesktop.Telepathy.ConnectionManager.gabble'
-text = 'org.freedesktop.Telepathy.Channel.Type.Text'
-sm = 'org.freedesktop.Telepathy.Channel.Type.StreamedMedia'
-conn_iface = 'org.freedesktop.Telepathy.Connection'
-caps_iface = 'org.freedesktop.Telepathy.Connection.Interface.Capabilities'
+import constants as cs
 
 caps_changed_flag = False
 
@@ -64,7 +59,7 @@ def test_hash(q, bus, conn, stream, contact, contact_handle, client):
                 (2, u'available', 'hello')}]))
 
     # no special capabilities
-    basic_caps = [(contact_handle, text, 3, 0)]
+    basic_caps = [(contact_handle, cs.CHANNEL_TYPE_TEXT, 3, 0)]
     assert conn.Capabilities.GetCapabilities([contact_handle]) == basic_caps
 
     # send updated presence with Jingle caps info
@@ -230,9 +225,9 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2,
                 (2, u'available', 'hello')}]))
 
     # no special capabilities
-    basic_caps = [(contact_handle1, text, 3, 0)]
+    basic_caps = [(contact_handle1, cs.CHANNEL_TYPE_TEXT, 3, 0)]
     assert conn.Capabilities.GetCapabilities([contact_handle1]) == basic_caps
-    basic_caps = [(contact_handle2, text, 3, 0)]
+    basic_caps = [(contact_handle2, cs.CHANNEL_TYPE_TEXT, 3, 0)]
     assert conn.Capabilities.GetCapabilities([contact_handle2]) == basic_caps
 
     # send updated presence with Jingle caps info
@@ -298,12 +293,14 @@ def test_two_clients(q, bus, conn, stream, contact1, contact2,
 
     # we can now do audio calls with both contacts
     event = q.expect('dbus-signal', signal='CapabilitiesChanged',
-        args=[[(contact_handle2, sm, 0, 3, 0, 1)]])#  what are the good values?!
+        #  what are the good values?!
+        args=[[(contact_handle2, cs.CHANNEL_TYPE_STREAMED_MEDIA, 0, 3, 0, 1)]])
     if not broken_hash:
         # if the first contact failed to provide a good hash, it does not
         # deserve its capabilities to be understood by Gabble!
         event = q.expect('dbus-signal', signal='CapabilitiesChanged',
-            args=[[(contact_handle1, sm, 0, 3, 0, 1)]])#  what are the good values?!
+            #  what are the good values?!
+            args=[[(contact_handle1, cs.CHANNEL_TYPE_STREAMED_MEDIA, 0, 3, 0, 1)]])
 
     caps_changed_flag = False
 
@@ -316,7 +313,7 @@ def test(q, bus, conn, stream):
     q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
 
     # be notified when the signal CapabilitiesChanged is fired
-    conn_caps_iface = dbus.Interface(conn, caps_iface)
+    conn_caps_iface = dbus.Interface(conn, cs.CONN_IFACE_CAPS)
     conn_caps_iface.connect_to_signal('CapabilitiesChanged', caps_changed_cb)
 
     test_hash(q, bus, conn, stream, 'bob at foo.com/Foo', 2L, 'http://telepathy.freedesktop.org/fake-client')
diff --git a/tests/twisted/text/destroy.py b/tests/twisted/text/destroy.py
index b3abb7f..01ede8a 100644
--- a/tests/twisted/text/destroy.py
+++ b/tests/twisted/text/destroy.py
@@ -9,6 +9,7 @@ from twisted.words.xish import domish
 
 from gabbletest import exec_test
 from servicetest import call_async, EventPattern, tp_path_prefix
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -23,7 +24,7 @@ def test(q, bus, conn, stream):
     foo_handle = event.value[0][0]
 
     call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.Text', 1, foo_handle, True)
+        cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, foo_handle, True)
 
     ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
@@ -32,17 +33,13 @@ def test(q, bus, conn, stream):
         )
 
     text_chan = bus.get_object(conn.bus_name, ret.value[0])
-    chan_iface = dbus.Interface(text_chan,
-            'org.freedesktop.Telepathy.Channel')
-    text_iface = dbus.Interface(text_chan,
-            'org.freedesktop.Telepathy.Channel.Type.Text')
-    destroyable_iface = dbus.Interface(text_chan,
-            'org.freedesktop.Telepathy.Channel.Interface.Destroyable')
+    chan_iface = dbus.Interface(text_chan, cs.CHANNEL)
+    text_iface = dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT)
+    destroyable_iface = dbus.Interface(text_chan, cs.CHANNEL_IFACE_DESTROYABLE)
 
     assert old_sig.args[0] == ret.value[0]
-    assert old_sig.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    # check that handle type == contact handle
-    assert old_sig.args[2] == 1
+    assert old_sig.args[1] == cs.CHANNEL_TYPE_TEXT
+    assert old_sig.args[2] == cs.HT_CONTACT
     assert old_sig.args[3] == foo_handle
     assert old_sig.args[4] == True      # suppress handler
 
@@ -51,25 +48,17 @@ def test(q, bus, conn, stream):
     assert len(new_sig.args[0][0]) == 2     # two struct members
     assert new_sig.args[0][0][0] == ret.value[0]
     emitted_props = new_sig.args[0][0][1]
-    assert emitted_props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.Text'
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 1
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            foo_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetID'] == jid
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'Requested'] == True
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorHandle'] == self_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorID'] == 'test at localhost'
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
+    assert emitted_props[cs.TARGET_HANDLE] == foo_handle
+    assert emitted_props[cs.TARGET_ID] == jid
+    assert emitted_props[cs.REQUESTED] == True
+    assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
+    assert emitted_props[cs.INITIATOR_ID] == 'test at localhost'
 
     channel_props = text_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
-    assert channel_props['TargetID'] == jid,\
-            (channel_props['TargetID'], jid)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
+    assert channel_props['TargetID'] == jid, (channel_props['TargetID'], jid)
     assert channel_props['Requested'] == True
     assert channel_props['InitiatorHandle'] == self_handle,\
             (channel_props['InitiatorHandle'], self_handle)
@@ -107,7 +96,7 @@ def test(q, bus, conn, stream):
     assert event.args[5] == 'hello'
 
     messages = text_chan.ListPendingMessages(False,
-            dbus_interface='org.freedesktop.Telepathy.Channel.Type.Text')
+            dbus_interface=cs.CHANNEL_TYPE_TEXT)
     assert messages == \
             [(hello_message_id, hello_message_time, foo_handle,
                 0, 0, 'hello')], messages
diff --git a/tests/twisted/text/ensure.py b/tests/twisted/text/ensure.py
index 6722967..590018f 100644
--- a/tests/twisted/text/ensure.py
+++ b/tests/twisted/text/ensure.py
@@ -6,6 +6,7 @@ import dbus
 
 from gabbletest import exec_test
 from servicetest import call_async, EventPattern
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -20,16 +21,12 @@ def test(q, bus, conn, stream):
     handles = event.value[0]
 
     properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=cs.PROPERTIES_IFACE)
     assert properties.get('Channels') == [], properties['Channels']
-    assert ({'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
+    assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+             cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
              },
-             ['org.freedesktop.Telepathy.Channel.TargetHandle',
-              'org.freedesktop.Telepathy.Channel.TargetID'
-             ],
+             [cs.TARGET_HANDLE, cs.TARGET_ID],
              ) in properties.get('RequestableChannelClasses'),\
                      properties['RequestableChannelClasses']
 
@@ -68,9 +65,8 @@ def test_ensure_ensure(q, conn, self_handle, jid, handle):
     old_path, old_ct, old_ht, old_h, old_sh = old_sig.args
 
     assert old_path == path
-    assert old_ct == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    # check that handle type == contact handle
-    assert old_ht == 1
+    assert old_ct == cs.CHANNEL_TYPE_TEXT
+    assert old_ht == cs.HT_CONTACT
     assert old_h == handle
     assert old_sh == True      # suppress handler
 
@@ -81,15 +77,14 @@ def test_ensure_ensure(q, conn, self_handle, jid, handle):
     assert new_sig.args[0][0][1] == emitted_props
 
     properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert new_sig.args[0][0] in properties['Channels'], \
             (new_sig.args[0][0], properties['Channels'])
 
 
     # Now try Ensuring a channel which already exists
-    call_async(q, conn.Requests, 'EnsureChannel', request_props (handle))
+    call_async(q, conn.Requests, 'EnsureChannel', request_props(handle))
     ret_ = q.expect('dbus-return', method='EnsureChannel')
 
     assert len(ret_.value) == 3
@@ -108,7 +103,7 @@ def test_request_ensure(q, conn, self_handle, jid, handle):
     The call to Ensure should succeed with Yours=False.
     """
 
-    call_async(q, conn.Requests, 'CreateChannel', request_props (handle))
+    call_async(q, conn.Requests, 'CreateChannel', request_props(handle))
 
     ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='CreateChannel'),
@@ -125,9 +120,8 @@ def test_request_ensure(q, conn, self_handle, jid, handle):
     old_path, old_ct, old_ht, old_h, old_sh = old_sig.args
 
     assert old_path == path
-    assert old_ct == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    # check that handle type == contact handle
-    assert old_ht == 1
+    assert old_ct == cs.CHANNEL_TYPE_TEXT
+    assert old_ht == cs.HT_CONTACT
     assert old_h == handle
     assert old_sh == True      # suppress handler
 
@@ -138,15 +132,14 @@ def test_request_ensure(q, conn, self_handle, jid, handle):
     assert new_sig.args[0][0][1] == emitted_props
 
     properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert new_sig.args[0][0] in properties['Channels'], \
             (new_sig.args[0][0], properties['Channels'])
 
 
     # Now try Ensuring that same channel.
-    call_async(q, conn.Requests, 'EnsureChannel', request_props (handle))
+    call_async(q, conn.Requests, 'EnsureChannel', request_props(handle))
     ret_ = q.expect('dbus-return', method='EnsureChannel')
 
     assert len(ret_.value) == 3
@@ -160,26 +153,19 @@ def test_request_ensure(q, conn, self_handle, jid, handle):
 
 
 def check_props(props, self_handle, handle, jid):
-    assert props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.Text'
-    assert props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 1
-    assert props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            handle
-    assert props['org.freedesktop.Telepathy.Channel.TargetID'] == jid
-    assert props['org.freedesktop.Telepathy.Channel.'
-            'Requested'] == True
-    assert props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorHandle'] == self_handle
-    assert props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorID'] == 'test at localhost'
+    assert props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT
+    assert props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
+    assert props[cs.TARGET_HANDLE] == handle
+    assert props[cs.TARGET_ID] == jid
+    assert props[cs.REQUESTED] == True
+    assert props[cs.INITIATOR_HANDLE] == self_handle
+    assert props[cs.INITIATOR_ID] == 'test at localhost'
 
 
 def request_props(handle):
-    return { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-             'org.freedesktop.Telepathy.Channel.TargetHandle': handle,
+    return { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+             cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+             cs.TARGET_HANDLE: handle,
            }
 
 
diff --git a/tests/twisted/text/initiate-requestotron.py b/tests/twisted/text/initiate-requestotron.py
index 9436693..c24f1a8 100644
--- a/tests/twisted/text/initiate-requestotron.py
+++ b/tests/twisted/text/initiate-requestotron.py
@@ -6,6 +6,7 @@ import dbus
 
 from gabbletest import exec_test
 from servicetest import call_async, EventPattern
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -14,30 +15,22 @@ def test(q, bus, conn, stream):
     self_handle = conn.GetSelfHandle()
 
     jid = 'foo at bar.com'
-    call_async(q, conn, 'RequestHandles', 1, [jid])
-
-    event = q.expect('dbus-return', method='RequestHandles')
-    foo_handle = event.value[0][0]
+    foo_handle = conn.RequestHandles(cs.HT_CONTACT, [jid])[0]
 
     properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
     assert properties.get('Channels') == [], properties['Channels']
-    assert ({'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
+    assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+             cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
              },
-             ['org.freedesktop.Telepathy.Channel.TargetHandle',
-              'org.freedesktop.Telepathy.Channel.TargetID'
-             ],
+             [cs.TARGET_HANDLE, cs.TARGET_ID],
              ) in properties.get('RequestableChannelClasses'),\
                      properties['RequestableChannelClasses']
 
     call_async(q, conn.Requests, 'CreateChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': foo_handle,
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: foo_handle,
               })
 
     ret, old_sig, new_sig = q.expect_many(
@@ -48,24 +41,17 @@ def test(q, bus, conn, stream):
 
     assert len(ret.value) == 2
     emitted_props = ret.value[1]
-    assert emitted_props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.Text'
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 1
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            foo_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetID'] == jid
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'Requested'] == True
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorHandle'] == self_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorID'] == 'test at localhost'
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
+    assert emitted_props[cs.TARGET_HANDLE] == foo_handle
+    assert emitted_props[cs.TARGET_ID] == jid
+    assert emitted_props[cs.REQUESTED] == True
+    assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
+    assert emitted_props[cs.INITIATOR_ID] == 'test at localhost'
 
     assert old_sig.args[0] == ret.value[0]
-    assert old_sig.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    # check that handle type == contact handle
-    assert old_sig.args[2] == 1
+    assert old_sig.args[1] == cs.CHANNEL_TYPE_TEXT
+    assert old_sig.args[2] == cs.HT_CONTACT
     assert old_sig.args[3] == foo_handle
     assert old_sig.args[4] == True      # suppress handler
 
@@ -76,8 +62,7 @@ def test(q, bus, conn, stream):
     assert new_sig.args[0][0][1] == ret.value[1]
 
     properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=dbus.PROPERTIES_IFACE)
 
     assert new_sig.args[0][0] in properties['Channels'], \
             (new_sig.args[0][0], properties['Channels'])
diff --git a/tests/twisted/text/initiate.py b/tests/twisted/text/initiate.py
index 78bfdba..9554b6d 100644
--- a/tests/twisted/text/initiate.py
+++ b/tests/twisted/text/initiate.py
@@ -8,6 +8,7 @@ from twisted.words.xish import domish
 
 from gabbletest import exec_test
 from servicetest import call_async, EventPattern
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -16,13 +17,13 @@ def test(q, bus, conn, stream):
     self_handle = conn.GetSelfHandle()
 
     jid = 'foo at bar.com'
-    call_async(q, conn, 'RequestHandles', 1, [jid])
+    call_async(q, conn, 'RequestHandles', cs.HT_CONTACT, [jid])
 
     event = q.expect('dbus-return', method='RequestHandles')
     foo_handle = event.value[0][0]
 
     call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.Text', 1, foo_handle, True)
+        cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, foo_handle, True)
 
     ret, sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
@@ -33,8 +34,7 @@ def test(q, bus, conn, stream):
 
     assert sig.args[0] == ret.value[0], \
             (sig.args[0], ret.value[0])
-    assert sig.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text',\
-            sig.args[1]
+    assert sig.args[1] == cs.CHANNEL_TYPE_TEXT, sig.args[1]
     # check that handle type == contact handle
     assert sig.args[2] == 1, sig.args[1]
     assert sig.args[3] == foo_handle, (sig.args[3], foo_handle)
@@ -42,16 +42,15 @@ def test(q, bus, conn, stream):
 
     # Exercise basic Channel Properties from spec 0.17.7
     channel_props = text_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props.get('TargetHandle') == foo_handle,\
             (channel_props.get('TargetHandle'), foo_handle)
     assert channel_props.get('TargetHandleType') == 1,\
             channel_props.get('TargetHandleType')
     assert channel_props.get('ChannelType') == \
-            'org.freedesktop.Telepathy.Channel.Type.Text',\
+            cs.CHANNEL_TYPE_TEXT,\
             channel_props.get('ChannelType')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.ChatState' in \
+    assert cs.CHANNEL_IFACE_CHAT_STATE in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
     assert channel_props['TargetID'] == jid,\
@@ -62,8 +61,7 @@ def test(q, bus, conn, stream):
     assert channel_props['InitiatorID'] == 'test at localhost',\
             channel_props['InitiatorID']
 
-    dbus.Interface(text_chan,
-        u'org.freedesktop.Telepathy.Channel.Type.Text').Send(0, 'hey')
+    dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT).Send(0, 'hey')
 
     event = q.expect('stream-message')
 
diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py
index b924f03..a1fd16e 100644
--- a/tests/twisted/text/respawn.py
+++ b/tests/twisted/text/respawn.py
@@ -8,6 +8,7 @@ from twisted.words.xish import domish
 
 from gabbletest import exec_test
 from servicetest import call_async, EventPattern, tp_path_prefix
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -16,13 +17,10 @@ def test(q, bus, conn, stream):
     self_handle = conn.GetSelfHandle()
 
     jid = 'foo at bar.com'
-    call_async(q, conn, 'RequestHandles', 1, [jid])
-
-    event = q.expect('dbus-return', method='RequestHandles')
-    foo_handle = event.value[0][0]
+    foo_handle = conn.RequestHandles(cs.HT_CONTACT, [jid])[0]
 
     call_async(q, conn, 'RequestChannel',
-        'org.freedesktop.Telepathy.Channel.Type.Text', 1, foo_handle, True)
+        cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, foo_handle, True)
 
     ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
@@ -31,15 +29,12 @@ def test(q, bus, conn, stream):
         )
 
     text_chan = bus.get_object(conn.bus_name, ret.value[0])
-    chan_iface = dbus.Interface(text_chan,
-            'org.freedesktop.Telepathy.Channel')
-    text_iface = dbus.Interface(text_chan,
-            'org.freedesktop.Telepathy.Channel.Type.Text')
+    chan_iface = dbus.Interface(text_chan, cs.CHANNEL)
+    text_iface = dbus.Interface(text_chan, cs.CHANNEL_TYPE_TEXT)
 
     assert old_sig.args[0] == ret.value[0]
-    assert old_sig.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    # check that handle type == contact handle
-    assert old_sig.args[2] == 1
+    assert old_sig.args[1] == cs.CHANNEL_TYPE_TEXT
+    assert old_sig.args[2] == cs.HT_CONTACT
     assert old_sig.args[3] == foo_handle
     assert old_sig.args[4] == True      # suppress handler
 
@@ -48,23 +43,16 @@ def test(q, bus, conn, stream):
     assert len(new_sig.args[0][0]) == 2     # two struct members
     assert new_sig.args[0][0][0] == ret.value[0]
     emitted_props = new_sig.args[0][0][1]
-    assert emitted_props['org.freedesktop.Telepathy.Channel.ChannelType'] ==\
-            'org.freedesktop.Telepathy.Channel.Type.Text'
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'TargetHandleType'] == 1
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetHandle'] ==\
-            foo_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.TargetID'] == jid
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'Requested'] == True
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorHandle'] == self_handle
-    assert emitted_props['org.freedesktop.Telepathy.Channel.'
-            'InitiatorID'] == 'test at localhost'
+    assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_TEXT
+    assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
+    assert emitted_props[cs.TARGET_HANDLE] == foo_handle
+    assert emitted_props[cs.TARGET_ID] == jid
+    assert emitted_props[cs.REQUESTED] == True
+    assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
+    assert emitted_props[cs.INITIATOR_ID] == 'test at localhost'
 
     channel_props = text_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetID'] == jid,\
             (channel_props['TargetID'], jid)
     assert channel_props['Requested'] == True
@@ -104,7 +92,7 @@ def test(q, bus, conn, stream):
     assert event.args[5] == 'hello'
 
     messages = text_chan.ListPendingMessages(False,
-            dbus_interface='org.freedesktop.Telepathy.Channel.Type.Text')
+        dbus_interface=cs.CHANNEL_TYPE_TEXT)
     assert messages == \
             [(hello_message_id, hello_message_time, foo_handle,
                 0, 0, 'hello')], messages
@@ -124,8 +112,8 @@ def test(q, bus, conn, stream):
 
     event = q.expect('dbus-signal', signal='NewChannel')
     assert event.args[0] == text_chan.object_path
-    assert event.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    assert event.args[2] == 1   # CONTACT
+    assert event.args[1] == cs.CHANNEL_TYPE_TEXT
+    assert event.args[2] == cs.HT_CONTACT
     assert event.args[3] == foo_handle
     assert event.args[4] == False   # suppress handler
 
@@ -134,8 +122,7 @@ def test(q, bus, conn, stream):
     # it now behaves as if the message had initiated it
 
     channel_props = text_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetID'] == jid,\
             (channel_props['TargetID'], jid)
     assert channel_props['Requested'] == False
@@ -147,7 +134,7 @@ def test(q, bus, conn, stream):
     # the message is still there
 
     messages = text_chan.ListPendingMessages(False,
-            dbus_interface='org.freedesktop.Telepathy.Channel.Type.Text')
+        dbus_interface=cs.CHANNEL_TYPE_TEXT)
     assert messages == \
             [(hello_message_id, hello_message_time, foo_handle,
                 0, 8, 'hello')], messages
@@ -155,10 +142,10 @@ def test(q, bus, conn, stream):
     # acknowledge it
 
     text_chan.AcknowledgePendingMessages([hello_message_id],
-            dbus_interface='org.freedesktop.Telepathy.Channel.Type.Text')
+        dbus_interface=cs.CHANNEL_TYPE_TEXT)
 
     messages = text_chan.ListPendingMessages(False,
-            dbus_interface='org.freedesktop.Telepathy.Channel.Type.Text')
+        dbus_interface=cs.CHANNEL_TYPE_TEXT)
     assert messages == []
 
     # close the channel again
diff --git a/tests/twisted/text/send-error.py b/tests/twisted/text/send-error.py
index 5008e84..9ecc31b 100644
--- a/tests/twisted/text/send-error.py
+++ b/tests/twisted/text/send-error.py
@@ -7,7 +7,7 @@ from twisted.words.xish import domish
 
 from gabbletest import exec_test
 from servicetest import call_async, EventPattern
-
+import constants as cs
 import ns
 
 def test_temporary_error(q, bus, conn, stream):
@@ -19,19 +19,12 @@ def test_temporary_error(q, bus, conn, stream):
     event = q.expect('dbus-return', method='RequestHandles')
     foo_handle = event.value[0][0]
 
-    properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface='org.freedesktop.DBus.Properties')
-
-    call_async(q, conn.Requests, 'CreateChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': foo_handle,
-              })
-
-    ret = q.expect('dbus-return', method='CreateChannel')
-    text_chan = bus.get_object(conn.bus_name, ret.value[0])
+    path = conn.Requests.CreateChannel(
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: foo_handle,
+              })[0]
+    text_chan = bus.get_object(conn.bus_name, path)
 
     # <message from='foo at bar.com' type='error'>
     #   <body>what is up, my good sir?</body>
@@ -107,19 +100,12 @@ def test_permanent_error(q, bus, conn, stream):
     event = q.expect('dbus-return', method='RequestHandles')
     ninja_handle = event.value[0][0]
 
-    properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface='org.freedesktop.DBus.Properties')
-
-    call_async(q, conn.Requests, 'CreateChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': ninja_handle,
-              })
-
-    ret = q.expect('dbus-return', method='CreateChannel')
-    text_chan = bus.get_object(conn.bus_name, ret.value[0])
+    path = conn.Requests.CreateChannel(
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: ninja_handle,
+              })[0]
+    text_chan = bus.get_object(conn.bus_name, path)
 
     # <message from='wee at ninja.jp' type='error'>
     #   <body>hello? is there anyone there?</body>
diff --git a/tests/twisted/text/test-chat-state.py b/tests/twisted/text/test-chat-state.py
index d72b1ac..d8bbe78 100644
--- a/tests/twisted/text/test-chat-state.py
+++ b/tests/twisted/text/test-chat-state.py
@@ -8,7 +8,7 @@ from twisted.words.xish import domish
 
 from servicetest import call_async, make_channel_proxy
 from gabbletest import exec_test, make_result_iq, sync_stream, make_presence
-
+import constants as cs
 import ns
 
 CHAT_STATE_ACTIVE = 2
@@ -21,17 +21,13 @@ def test(q, bus, conn, stream):
     self_handle = conn.GetSelfHandle()
 
     jid = 'foo at bar.com'
-    foo_handle = conn.RequestHandles(1, [jid])[0]
-
-    call_async(q, conn.Requests, 'CreateChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Text',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': foo_handle,
-              })
+    foo_handle = conn.RequestHandles(cs.HT_CONTACT, [jid])[0]
 
-    ret = q.expect('dbus-return', method='CreateChannel')
-    path = ret.value[0]
+    path = conn.Requests.CreateChannel(
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TEXT,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: foo_handle,
+              })[0]
     text_chan = bus.get_object(conn.bus_name, path)
     text_iface = make_channel_proxy(conn, path, 'Channel.Type.Text')
     chat_state_iface = make_channel_proxy(conn, path,
diff --git a/tests/twisted/text/test-text-delayed.py b/tests/twisted/text/test-text-delayed.py
index 519a950..1a2266c 100644
--- a/tests/twisted/text/test-text-delayed.py
+++ b/tests/twisted/text/test-text-delayed.py
@@ -9,6 +9,7 @@ from twisted.words.xish import domish
 
 from gabbletest import exec_test
 from servicetest import EventPattern
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -26,10 +27,9 @@ def test(q, bus, conn, stream):
     stream.send(m)
 
     event = q.expect('dbus-signal', signal='NewChannel')
-    assert event.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    # check that handle type == contact handle
-    assert event.args[2] == 1
-    jid = conn.InspectHandles(1, [event.args[3]])[0]
+    assert event.args[1] == cs.CHANNEL_TYPE_TEXT
+    assert event.args[2] == cs.HT_CONTACT
+    jid = conn.InspectHandles(cs.HT_CONTACT, [event.args[3]])[0]
     assert jid == 'foo at bar.com'
 
     received, message_received = q.expect_many(
diff --git a/tests/twisted/text/test-text-no-body.py b/tests/twisted/text/test-text-no-body.py
index eb8fcee..67847ac 100644
--- a/tests/twisted/text/test-text-no-body.py
+++ b/tests/twisted/text/test-text-no-body.py
@@ -7,7 +7,7 @@ new text channel.
 from twisted.words.xish import domish
 
 from gabbletest import exec_test
-
+import constants as cs
 import ns
 
 def test(q, bus, conn, stream):
@@ -31,8 +31,8 @@ def test(q, bus, conn, stream):
 
     # first message should be from Bob, not Alice
     event = q.expect('dbus-signal', signal='NewChannel')
-    assert event.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    jid = conn.InspectHandles(1, [event.args[3]])[0]
+    assert event.args[1] == cs.CHANNEL_TYPE_TEXT
+    jid = conn.InspectHandles(cs.HT_CONTACT, [event.args[3]])[0]
     assert jid == 'bob at foo.com'
     conn.Disconnect()
     q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
diff --git a/tests/twisted/text/test-text.py b/tests/twisted/text/test-text.py
index 2eb4fde..c4cfaea 100644
--- a/tests/twisted/text/test-text.py
+++ b/tests/twisted/text/test-text.py
@@ -9,6 +9,7 @@ from twisted.words.xish import domish
 
 from gabbletest import exec_test
 from servicetest import EventPattern, wrap_channel
+import constants as cs
 
 def test(q, bus, conn, stream):
     conn.Connect()
@@ -25,28 +26,26 @@ def test(q, bus, conn, stream):
     event = q.expect('dbus-signal', signal='NewChannel')
     text_chan = wrap_channel(
         bus.get_object(conn.bus_name, event.args[0]), 'Text', ['Messages'])
-    assert event.args[1] == u'org.freedesktop.Telepathy.Channel.Type.Text'
-    # check that handle type == contact handle
-    assert event.args[2] == 1
+    assert event.args[1] == cs.CHANNEL_TYPE_TEXT
+    assert event.args[2] == cs.HT_CONTACT
     foo_at_bar_dot_com_handle = event.args[3]
     jid = conn.InspectHandles(1, [foo_at_bar_dot_com_handle])[0]
     assert jid == 'foo at bar.com'
     assert event.args[4] == False   # suppress handler
 
     # Exercise basic Channel Properties from spec 0.17.7
-    channel_props = text_chan.Properties.GetAll(
-            'org.freedesktop.Telepathy.Channel')
+    channel_props = text_chan.Properties.GetAll(cs.CHANNEL)
     assert channel_props.get('TargetHandle') == event.args[3],\
             (channel_props.get('TargetHandle'), event.args[3])
-    assert channel_props.get('TargetHandleType') == 1,\
+    assert channel_props.get('TargetHandleType') == cs.HT_CONTACT,\
             channel_props.get('TargetHandleType')
     assert channel_props.get('ChannelType') == \
-            'org.freedesktop.Telepathy.Channel.Type.Text',\
+            cs.CHANNEL_TYPE_TEXT,\
             channel_props.get('ChannelType')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.ChatState' in \
+    assert cs.CHANNEL_IFACE_CHAT_STATE in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
-    assert 'org.freedesktop.Telepathy.Channel.Interface.Messages' in \
+    assert cs.CHANNEL_IFACE_MESSAGES in \
             channel_props.get('Interfaces', ()), \
             channel_props.get('Interfaces')
     assert channel_props['TargetID'] == jid,\
diff --git a/tests/twisted/tubes/close-muc-with-closed-tube.py b/tests/twisted/tubes/close-muc-with-closed-tube.py
index a3f7c31..cc8a7c3 100644
--- a/tests/twisted/tubes/close-muc-with-closed-tube.py
+++ b/tests/twisted/tubes/close-muc-with-closed-tube.py
@@ -2,7 +2,7 @@
 
 import dbus
 
-from servicetest import call_async, EventPattern, tp_name_prefix, unwrap
+from servicetest import call_async, EventPattern, unwrap
 from gabbletest import exec_test, make_result_iq, acknowledge_iq, make_muc_presence
 import constants as cs
 import ns
@@ -25,8 +25,7 @@ def test(q, bus, conn, stream):
 
     acknowledge_iq(stream, iq_event.stanza)
 
-    call_async(q, conn, 'RequestHandles', 2,
-        ['chat at conf.localhost'])
+    call_async(q, conn, 'RequestHandles', cs.HT_ROOM, ['chat at conf.localhost'])
 
     event = q.expect('stream-iq', to='conf.localhost',
             query_ns='http://jabber.org/protocol/disco#info')
@@ -41,7 +40,7 @@ def test(q, bus, conn, stream):
 
     # join the muc
     call_async(q, conn, 'RequestChannel',
-        tp_name_prefix + '.Channel.Type.Text', 2, room_handle, True)
+        cs.CHANNEL_TYPE_TEXT, cs.HT_ROOM, room_handle, True)
 
     _, stream_event = q.expect_many(
         EventPattern('dbus-signal', signal='MembersChanged',
@@ -57,8 +56,8 @@ def test(q, bus, conn, stream):
     q.expect('dbus-signal', signal='MembersChanged',
             args=[u'', [2, 3], [], [], [], 0, 0])
 
-    assert conn.InspectHandles(1, [2]) == ['chat at conf.localhost/test']
-    assert conn.InspectHandles(1, [3]) == ['chat at conf.localhost/bob']
+    assert conn.InspectHandles(cs.HT_CONTACT, [2, 3]) == \
+        ['chat at conf.localhost/test', 'chat at conf.localhost/bob']
     bob_handle = 3
 
     event = q.expect('dbus-return', method='RequestChannel')
@@ -99,28 +98,26 @@ def test(q, bus, conn, stream):
     # tubes channel is automatically created
     event = q.expect('dbus-signal', signal='NewChannel')
 
-    if event.args[1] == 'org.freedesktop.Telepathy.Channel.Type.Text':
+    if event.args[1] == cs.CHANNEL_TYPE_TEXT:
         # skip this one, try the next one
         event = q.expect('dbus-signal', signal='NewChannel')
 
-    assert event.args[1] == 'org.freedesktop.Telepathy.Channel.Type.Tubes',\
-        event.args
-    assert event.args[2] == 2 # Handle_Type_Room
+    assert event.args[1] == cs.CHANNEL_TYPE_TUBES, event.args
+    assert event.args[2] == cs.HT_ROOM
     assert event.args[3] == room_handle
 
     tubes_chan = bus.get_object(conn.bus_name, event.args[0])
     tubes_iface = dbus.Interface(tubes_chan, event.args[1])
 
     channel_props = tubes_chan.GetAll(
-            'org.freedesktop.Telepathy.Channel',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CHANNEL, dbus_interface=dbus.PROPERTIES_IFACE)
     assert channel_props['TargetID'] == 'chat at conf.localhost', channel_props
     assert channel_props['Requested'] == False
     assert channel_props['InitiatorID'] == ''
     assert channel_props['InitiatorHandle'] == 0
 
     tubes_self_handle = tubes_chan.GetSelfHandle(
-        dbus_interface=tp_name_prefix + '.Channel.Interface.Group')
+        dbus_interface=cs.CHANNEL_IFACE_GROUP)
 
     q.expect('dbus-signal', signal='NewTube',
         args=[tube_id, bob_handle, 0, 'org.telepathy.freedesktop.test', sample_parameters, 0])
diff --git a/tests/twisted/tubes/crash-on-list-channels.py b/tests/twisted/tubes/crash-on-list-channels.py
index 3fe4c9d..9c33ce0 100644
--- a/tests/twisted/tubes/crash-on-list-channels.py
+++ b/tests/twisted/tubes/crash-on-list-channels.py
@@ -9,7 +9,7 @@ from servicetest import call_async, EventPattern
 from gabbletest import exec_test, sync_stream
 
 import ns
-import constants
+import constants as cs
 
 from twisted.words.xish import domish
 
@@ -50,11 +50,12 @@ def test(q, bus, conn, stream):
 
     sync_stream(q, stream)
 
-    h = conn.RequestHandles(1, [jid])[0]
-    tubes_path = conn.RequestChannel(constants.CHANNEL_TYPE_TUBES, 1, h, True)
+    h = conn.RequestHandles(cs.HT_CONTACT, [jid])[0]
+    tubes_path = conn.RequestChannel(
+        cs.CHANNEL_TYPE_TUBES, cs.HT_CONTACT, h, True)
 
     tubes_chan = bus.get_object(conn.bus_name, tubes_path)
-    tubes_iface = dbus.Interface(tubes_chan, constants.CHANNEL_TYPE_TUBES)
+    tubes_iface = dbus.Interface(tubes_chan, cs.CHANNEL_TYPE_TUBES)
 
     tubes_iface.OfferDBusTube('bong.hits', dbus.Dictionary({}, signature='sv'))
 
diff --git a/tests/twisted/tubes/create-invalid-tube-channels.py b/tests/twisted/tubes/create-invalid-tube-channels.py
index 3bc8916..1704242 100644
--- a/tests/twisted/tubes/create-invalid-tube-channels.py
+++ b/tests/twisted/tubes/create-invalid-tube-channels.py
@@ -30,9 +30,8 @@ def test(q, bus, conn, stream):
             {cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE,
              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
              cs.TARGET_ID: "foo at example.com",
-             'this.property.does.not.exist':
-                'this.value.should.not.exist'
-            });
+             'this.property.does.not.exist': 'this.value.should.not.exist'
+            })
     ret = q.expect('dbus-error', method='CreateChannel')
 
     check_no_tubes(conn_props)
@@ -43,7 +42,7 @@ def test(q, bus, conn, stream):
             {cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE,
              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
              cs.TARGET_ID: "foo at example.com",
-            });
+            })
     ret = q.expect('dbus-error', method='CreateChannel')
 
     check_no_tubes(conn_props)
diff --git a/tests/twisted/tubes/ensure-si-tube.py b/tests/twisted/tubes/ensure-si-tube.py
index 2e800b2..d7e95fc 100644
--- a/tests/twisted/tubes/ensure-si-tube.py
+++ b/tests/twisted/tubes/ensure-si-tube.py
@@ -6,6 +6,7 @@ import dbus
 
 from servicetest import call_async, EventPattern, tp_name_prefix
 from gabbletest import exec_test, acknowledge_iq
+import constants as cs
 import ns
 
 from twisted.words.xish import domish
@@ -26,16 +27,12 @@ def test(q, bus, conn, stream):
     conn.Connect()
 
     properties = conn.GetAll(
-            'org.freedesktop.Telepathy.Connection.Interface.Requests',
-            dbus_interface=dbus.PROPERTIES_IFACE)
+        cs.CONN_IFACE_REQUESTS, dbus_interface=cs.PROPERTIES_IFACE)
     assert properties.get('Channels') == [], properties['Channels']
-    assert ({'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Tubes',
-             'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
+    assert ({cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TUBES,
+             cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
              },
-             ['org.freedesktop.Telepathy.Channel.TargetHandle',
-              'org.freedesktop.Telepathy.Channel.TargetID',
-             ]
+             [cs.TARGET_HANDLE, cs.TARGET_ID]
              ) in properties.get('RequestableChannelClasses'),\
                      properties['RequestableChannelClasses']
 
@@ -77,7 +74,7 @@ def test(q, bus, conn, stream):
     bob_handle = conn.RequestHandles(1, ['bob at localhost'])[0]
 
     call_async(q, conn, 'RequestChannel',
-            tp_name_prefix + '.Channel.Type.Tubes', 1, bob_handle, True);
+        cs.CHANNEL_TYPE_TUBES, cs.HT_CONTACT, bob_handle, True);
 
     ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
@@ -92,10 +89,9 @@ def test(q, bus, conn, stream):
 
     # Ensure a tube to the same person; check it's the same one.
     call_async(q, conn.Requests, 'EnsureChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Tubes',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': bob_handle
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TUBES,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: bob_handle
               })
 
     ret = q.expect('dbus-return', method='EnsureChannel')
@@ -110,10 +106,9 @@ def test(q, bus, conn, stream):
 
     # Now let's try ensuring a new tube.
     call_async(q, conn.Requests, 'EnsureChannel',
-            { 'org.freedesktop.Telepathy.Channel.ChannelType':
-                'org.freedesktop.Telepathy.Channel.Type.Tubes',
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': 1,
-              'org.freedesktop.Telepathy.Channel.TargetHandle': bob_handle
+            { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_TUBES,
+              cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+              cs.TARGET_HANDLE: bob_handle
               })
 
     ret, old_sig, new_sig = q.expect_many(
diff --git a/tests/twisted/tubes/request-invalid-dbus-tube.py b/tests/twisted/tubes/request-invalid-dbus-tube.py
index 8a1cdad..599bddd 100644
--- a/tests/twisted/tubes/request-invalid-dbus-tube.py
+++ b/tests/twisted/tubes/request-invalid-dbus-tube.py
@@ -21,7 +21,7 @@ def test(q, bus, conn, stream):
                      cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
                      cs.TARGET_ID: 'alice at localhost',
                      cs.DBUS_TUBE_SERVICE_NAME: invalid_service_name
-                });
+                })
         except dbus.DBusException, e:
             assert e.get_dbus_name() == cs.INVALID_ARGUMENT, \
                 (e.get_dbus_name(), invalid_service_name)
diff --git a/tests/twisted/tubes/test-get-available-tubes.py b/tests/twisted/tubes/test-get-available-tubes.py
index d53d27c..7cebaa3 100644
--- a/tests/twisted/tubes/test-get-available-tubes.py
+++ b/tests/twisted/tubes/test-get-available-tubes.py
@@ -5,6 +5,7 @@ import dbus
 from servicetest import call_async, EventPattern, tp_name_prefix
 from gabbletest import (
     exec_test, make_result_iq, acknowledge_iq, make_muc_presence)
+import constants as cs
 
 sample_parameters = dbus.Dictionary({
     's': 'hello',
@@ -23,8 +24,7 @@ def test(q, bus, conn, stream):
 
     acknowledge_iq(stream, iq_event.stanza)
 
-    call_async(q, conn, 'RequestHandles', 2,
-        ['chat at conf.localhost'])
+    call_async(q, conn, 'RequestHandles', cs.HT_ROOM, ['chat at conf.localhost'])
 
     event = q.expect('stream-iq', to='conf.localhost',
             query_ns='http://jabber.org/protocol/disco#info')
@@ -38,7 +38,7 @@ def test(q, bus, conn, stream):
 
     # request tubes channel
     call_async(q, conn, 'RequestChannel',
-        tp_name_prefix + '.Channel.Type.Tubes', 2, handles[0], True)
+        tp_name_prefix + '.Channel.Type.Tubes', cs.HT_ROOM, handles[0], True)
 
     _, stream_event = q.expect_many(
         EventPattern('dbus-signal', signal='MembersChanged',
-- 
1.5.6.5




More information about the telepathy-commits mailing list