[Telepathy-commits] [telepathy-gabble/master] roster/test-roster.py: add a basic test for Requests.NewChannels

Simon McVittie simon.mcvittie at collabora.co.uk
Thu Aug 21 08:19:43 PDT 2008


20080801155047-53eee-8cf15205887315f326deba3779c4279328331974.gz
---
 tests/twisted/roster/test-roster.py |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/tests/twisted/roster/test-roster.py b/tests/twisted/roster/test-roster.py
index dde0d16..b7ad718 100644
--- a/tests/twisted/roster/test-roster.py
+++ b/tests/twisted/roster/test-roster.py
@@ -1,4 +1,3 @@
-
 """
 Test basic roster functionality.
 """
@@ -6,10 +5,15 @@ Test basic roster functionality.
 import dbus
 
 from gabbletest import exec_test
+from servicetest import EventPattern, tp_name_prefix
 
 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
+    old_signal, new_signal = q.expect_many(
+            EventPattern('dbus-signal', signal='NewChannel'),
+            EventPattern('dbus-signal', signal='NewChannels'),
+            )
+
+    path, type, handle_type, handle, suppress_handler = old_signal.args
 
     assert type == u'org.freedesktop.Telepathy.Channel.Type.ContactList'
     assert conn.InspectHandles(handle_type, [handle])[0] == name
@@ -19,6 +23,17 @@ def _expect_contact_list_channel(q, bus, conn, name, contacts):
     members = group_iface.GetMembers()
     assert conn.InspectHandles(1, members) == contacts
 
+    assert len(new_signal.args) == 1
+    assert len(new_signal.args[0]) == 1         # one channel
+    assert len(new_signal.args[0][0]) == 2      # two struct members
+    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
+
     # Exercise basic Channel Properties from spec 0.17.7
     channel_props = chan.GetAll(
             'org.freedesktop.Telepathy.Channel',
-- 
1.5.6.3




More information about the Telepathy-commits mailing list