[Telepathy-commits] [telepathy-gabble/master] text/respawn.py: do some cursory testing of the Requests signals

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Aug 20 09:38:33 PDT 2008


20080725125641-53eee-43d390831743cdc61c2cd8d12dd9a6dad8df5e9f.gz
---
 tests/twisted/text/respawn.py |   44 ++++++++++++++++++++++++++++++++--------
 1 files changed, 35 insertions(+), 9 deletions(-)

diff --git a/tests/twisted/text/respawn.py b/tests/twisted/text/respawn.py
index e5e5cec..1d283ee 100644
--- a/tests/twisted/text/respawn.py
+++ b/tests/twisted/text/respawn.py
@@ -24,9 +24,10 @@ def test(q, bus, conn, stream):
     call_async(q, conn, 'RequestChannel',
         'org.freedesktop.Telepathy.Channel.Type.Text', 1, foo_handle, True)
 
-    ret, sig = q.expect_many(
+    ret, old_sig, new_sig = q.expect_many(
         EventPattern('dbus-return', method='RequestChannel'),
         EventPattern('dbus-signal', signal='NewChannel'),
+        EventPattern('dbus-signal', signal='NewChannels'),
         )
 
     text_chan = bus.get_object(conn.bus_name, ret.value[0])
@@ -35,12 +36,32 @@ def test(q, bus, conn, stream):
     text_iface = dbus.Interface(text_chan,
             'org.freedesktop.Telepathy.Channel.Type.Text')
 
-    assert sig.args[0] == ret.value[0]
-    assert sig.args[1] == u'org.freedesktop.Telepathy.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 sig.args[2] == 1
-    assert sig.args[3] == foo_handle
-    assert sig.args[4] == True      # suppress handler
+    assert old_sig.args[2] == 1
+    assert old_sig.args[3] == foo_handle
+    assert old_sig.args[4] == True      # suppress handler
+
+    assert len(new_sig.args) == 1
+    assert len(new_sig.args[0]) == 1        # one channel
+    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.FUTURE.'
+            'Requested'] == True
+    assert emitted_props['org.freedesktop.Telepathy.Channel.FUTURE.'
+            'TargetID'] == jid
+    assert emitted_props['org.freedesktop.Telepathy.Channel.FUTURE.'
+            'InitiatorHandle'] == self_handle
+    assert emitted_props['org.freedesktop.Telepathy.Channel.FUTURE.'
+            'InitiatorID'] == 'test at localhost'
 
     future_props = text_chan.GetAll(
             'org.freedesktop.Telepathy.Channel.FUTURE',
@@ -93,9 +114,14 @@ def test(q, bus, conn, stream):
 
     call_async(q, chan_iface, 'Close')
 
-    event = q.expect('dbus-signal', signal='Closed')
-    assert tp_path_prefix + event.path == text_chan.object_path,\
-            (tp_path_prefix + event.path, text_chan.object_path)
+    old, new = q.expect_many(
+            EventPattern('dbus-signal', signal='Closed'),
+            EventPattern('dbus-signal', signal='ChannelClosed'),
+            )
+    assert tp_path_prefix + old.path == text_chan.object_path,\
+            (tp_path_prefix + old.path, text_chan.object_path)
+    assert new.args[0] == text_chan.object_path,\
+            (new.args[0], text_chan.object_path)
 
     event = q.expect('dbus-signal', signal='NewChannel')
     assert event.args[0] == text_chan.object_path
-- 
1.5.6.3




More information about the Telepathy-commits mailing list