[Telepathy-commits] [telepathy-gabble/master] test-caps-tubes.py: test the caps cache when it contains tubes

Alban Crequy alban.crequy at collabora.co.uk
Fri Dec 5 09:42:30 PST 2008


---
 tests/twisted/test-caps-tubes.py |   28 ++++++++++++++++++++++++++++
 1 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/tests/twisted/test-caps-tubes.py b/tests/twisted/test-caps-tubes.py
index 861f2a3..9334225 100644
--- a/tests/twisted/test-caps-tubes.py
+++ b/tests/twisted/test-caps-tubes.py
@@ -10,6 +10,8 @@ Test:
 - 1 D-Bus tube cap
 - 1 stream tube + 1 D-Bus tube caps
 - 2 stream tube + 2 D-Bus tube caps
+- 1 stream tube + 1 D-Bus tube caps, again, to test whether the caps cache
+  works with tubes
 
 TODO:
 - signals
@@ -318,6 +320,32 @@ def _test_tube_caps(q, bus, conn, stream, contact, contact_handle, client):
             [contact_handle][caps_iface + '/caps']
     assert caps_via_contacts_iface == caps, caps_via_contacts_iface
 
+    # send presence with both D-Bus and stream tube caps
+    presence = make_presence(contact, None, 'hello')
+    c = presence.addElement(('http://jabber.org/protocol/caps', 'c'))
+    c['node'] = client
+    c['ver'] = 'moS31cvk2kf9Zka4gb6ncj2VJCo='
+    c['hash'] = 'sha-1'
+    stream.send(presence)
+
+    # Gabble does not look up our capabilities because of the cache
+    sync_stream(q, stream)
+
+    #event = q.expect('dbus-signal', signal='CapabilitiesChanged')
+
+    # daap + xiangqi capabilities
+    daap_xiangqi_caps = [
+        (contact_handle, text_fixed_properties, text_allowed_properties),
+        (contact_handle, daap_fixed_properties, daap_allowed_properties),
+        (contact_handle, xiangqi_fixed_properties, xiangqi_allowed_properties)]
+    caps = conn_caps_iface.GetContactCapabilities([contact_handle])
+    assert caps == daap_xiangqi_caps, caps
+    # check the Contacts interface give the same caps
+    caps_via_contacts_iface = conn_contacts_iface.GetContactAttributes(
+            [contact_handle], [caps_iface], False) \
+            [contact_handle][caps_iface + '/caps']
+    assert caps_via_contacts_iface == caps, caps_via_contacts_iface
+
 
 def test(q, bus, conn, stream):
     conn.Connect()
-- 
1.5.6.5




More information about the Telepathy-commits mailing list