[Telepathy-commits] [telepathy-idle/master] Add the constants.py file from gabble

Jonathon Jongsma jonathon.jongsma at collabora.co.uk
Mon Feb 16 20:39:42 PST 2009


Use the constants in a few tests
---
 tests/twisted/channels/join-muc-channel.py |    8 ++--
 tests/twisted/constants.py                 |   45 ++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 4 deletions(-)
 create mode 100644 tests/twisted/constants.py

diff --git a/tests/twisted/channels/join-muc-channel.py b/tests/twisted/channels/join-muc-channel.py
index 7e2e73b..01f0bc5 100644
--- a/tests/twisted/channels/join-muc-channel.py
+++ b/tests/twisted/channels/join-muc-channel.py
@@ -5,6 +5,7 @@ Test connecting to a IRC channel
 
 from idletest import exec_test
 from servicetest import EventPattern, call_async
+import constants
 import dbus
 
 def test(q, bus, conn, stream):
@@ -21,10 +22,9 @@ def test(q, bus, conn, stream):
             value=('/org/freedesktop/Telepathy/Connection/idle/irc/test_40localhost/MucChannel%d' % room_handles[0],))
     q.expect('dbus-signal', signal='NewChannels',
             args=[[('/org/freedesktop/Telepathy/Connection/idle/irc/test_40localhost/MucChannel%d' % room_handles[0],
-                { u'org.freedesktop.Telepathy.Channel.ChannelType':
-                    u'org.freedesktop.Telepathy.Channel.Type.Text',
-                    u'org.freedesktop.Telepathy.Channel.TargetHandle': room_handles[0],
-                    u'org.freedesktop.Telepathy.Channel.TargetHandleType': 2L})]])
+                { CHANNEL_TYPE: u'org.freedesktop.Telepathy.Channel.Type.Text',
+                    TARGET_HANDLE: room_handles[0],
+                    TARGET_HANDLE_TYPE: 2L})]])
     q.expect('dbus-signal', signal='NewChannel',
             args=['/org/freedesktop/Telepathy/Connection/idle/irc/test_40localhost/MucChannel%d' % room_handles[0],
                 u'org.freedesktop.Telepathy.Channel.Type.Text', 2L, room_handles[0], 1])
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
new file mode 100644
index 0000000..769bd9d
--- /dev/null
+++ b/tests/twisted/constants.py
@@ -0,0 +1,45 @@
+"""
+Some handy constants for other tests to share and enjoy.
+"""
+
+HT_CONTACT = 1
+
+CHANNEL = "org.freedesktop.Telepathy.Channel"
+CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
+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 = CHANNEL + '.ChannelType'
+TARGET_HANDLE_TYPE = CHANNEL + '.TargetHandleType'
+TARGET_HANDLE = CHANNEL + '.TargetHandle'
+TARGET_ID = CHANNEL + '.TargetID'
+REQUESTED = CHANNEL + '.Requested'
+INITIATOR_HANDLE = CHANNEL + '.InitiatorHandle'
+INITIATOR_ID = CHANNEL + '.InitiatorID'
+
+CONN = "org.freedesktop.Telepathy.Connection"
+CONN_IFACE_REQUESTS = CONN + '.Interface.Requests'
+
+ERRORS = 'org.freedesktop.Telepathy.Errors'
+INVALID_ARGUMENT = ERRORS + '.InvalidArgument'
+NOT_IMPLEMENTED = ERRORS + '.NotImplemented'
+NOT_AVAILABLE = ERRORS + '.NotAvailable'
+
+TUBE_PARAMETERS = CHANNEL_IFACE_TUBE + '.Parameters'
+TUBE_STATE = CHANNEL_IFACE_TUBE + '.State'
+STREAM_TUBE_SERVICE = CHANNEL_TYPE_STREAM_TUBE + '.Service'
+DBUS_TUBE_SERVICE_NAME = CHANNEL_TYPE_DBUS_TUBE + '.ServiceName'
+
+TUBE_CHANNEL_STATE_LOCAL_PENDING = 0
+TUBE_CHANNEL_STATE_REMOTE_PENDING = 1
+TUBE_CHANNEL_STATE_OPEN = 2
+TUBE_CHANNEL_STATE_NOT_OFFERED = 3
+
+MEDIA_STREAM_TYPE_AUDIO = 0
+MEDIA_STREAM_TYPE_VIDEO = 1
+MEDIA_STREAM_STATE_DISCONNECTED = 0
+MEDIA_STREAM_STATE_CONNECTING = 1
+MEDIA_STREAM_STATE_CONNECTED = 2
+
-- 
1.5.6.5




More information about the telepathy-commits mailing list