[telepathy-mission-control/master] capabilities/draft-1.py: assert that legacy caps are still set

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Jul 27 07:20:50 PDT 2009


In all versions of telepathy-gabble that implement this draft, draft 1
ContactCapabilities are only respected for Tube channels, so Gabble
will not be callable unless MC *also* tells it (via the Capabilities
interface) that it should support StreamedMedia.

(This is a Gabble bug, but since MC does not currently cause it to be
exhibited, triggering it would be a regression of sorts; when we implement
draft 2 in Gabble, though, we should do it right.)
---
 test/twisted/capabilities/draft-1.py     |   26 +++++++++++++++++++++++---
 test/twisted/capabilities/legacy-caps.py |    4 ++--
 2 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/test/twisted/capabilities/draft-1.py b/test/twisted/capabilities/draft-1.py
index d4b61e0..629f3cc 100644
--- a/test/twisted/capabilities/draft-1.py
+++ b/test/twisted/capabilities/draft-1.py
@@ -52,7 +52,22 @@ def test(q, bus, mc):
     # wait for MC to download the properties
     expect_client_setup(q, [media_call])
 
-    def check_correct_caps(e):
+    def check_legacy_caps(e):
+        # Because MC has no idea how to map Client capabilities into legacy
+        # capabilities, it assumes that every client has all the flags in
+        # the world. In this example we have (only) a StreamedMedia client
+        # and a stream-tube client, so that's what MC will tell us.
+        add = e.args[0]
+        remove = e.args[1]
+
+        assert (cs.CHANNEL_TYPE_STREAMED_MEDIA, 2L**32-1) in add
+        assert (cs.CHANNEL_TYPE_STREAM_TUBE, 2L**32-1) in add
+        assert len(add) == 2
+        assert len(remove) == 0
+
+        return True
+
+    def check_draft_1_caps(e):
         # Because MC has no idea how to map Client capabilities into legacy
         # capabilities, it assumes that every client has all the flags in
         # the world. In this example we have (only) a StreamedMedia client
@@ -69,12 +84,17 @@ def test(q, bus, mc):
         "password": "secrecy"}, signature='sv')
     cm_name_ref, account = create_fakecm_account(q, bus, mc, params)
     conn = enable_fakecm_account(q, bus, mc, account, params,
-            extra_interfaces=[cs.CONN_IFACE_CONTACT_CAPS_DRAFT1],
+            extra_interfaces=[cs.CONN_IFACE_CONTACT_CAPS_DRAFT1,
+                cs.CONN_IFACE_CAPS],
             expect_after_connect=[
                 EventPattern('dbus-method-call', handled=False,
                     interface=cs.CONN_IFACE_CONTACT_CAPS_DRAFT1,
                     method='SetSelfCapabilities',
-                    predicate=check_correct_caps),
+                    predicate=check_draft_1_caps),
+                EventPattern('dbus-method-call', handled=False,
+                    interface=cs.CONN_IFACE_CAPS,
+                    method='AdvertiseCapabilities',
+                    predicate=check_legacy_caps),
                 ])
 
 if __name__ == '__main__':
diff --git a/test/twisted/capabilities/legacy-caps.py b/test/twisted/capabilities/legacy-caps.py
index 73ce5f0..6a57811 100644
--- a/test/twisted/capabilities/legacy-caps.py
+++ b/test/twisted/capabilities/legacy-caps.py
@@ -46,7 +46,7 @@ def test(q, bus, mc):
     # wait for MC to download the properties
     expect_client_setup(q, [media_call])
 
-    def check_correct_caps(e):
+    def check_legacy_caps(e):
         # Because MC has no idea how to map Client capabilities into legacy
         # capabilities, it assumes that every client has all the flags in
         # the world. In this example we have (only) a StreamedMedia client
@@ -70,7 +70,7 @@ def test(q, bus, mc):
                 EventPattern('dbus-method-call', handled=False,
                     interface=cs.CONN_IFACE_CAPS,
                     method='AdvertiseCapabilities',
-                    predicate=check_correct_caps),
+                    predicate=check_legacy_caps),
                 ])
 
 if __name__ == '__main__':
-- 
1.5.6.5




More information about the telepathy-commits mailing list