telepathy-haze: caps test: do a simple test for media caps changes

Jonny Lamb jonny at kemper.freedesktop.org
Wed May 2 06:32:02 PDT 2012


Module: telepathy-haze
Branch: master
Commit: d81cdd5171afb380bdf862b63ddd1858818f0523
URL:    http://cgit.freedesktop.org/telepathy/telepathy-haze/commit/?id=d81cdd5171afb380bdf862b63ddd1858818f0523

Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date:   Wed May  2 12:16:13 2012 +0100

caps test: do a simple test for media caps changes

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>

---

 tests/twisted/simple-caps.py |   33 ++++++++++++++++++++++++++++++++-
 1 files changed, 32 insertions(+), 1 deletions(-)

diff --git a/tests/twisted/simple-caps.py b/tests/twisted/simple-caps.py
index 519d0bd..a16f551 100644
--- a/tests/twisted/simple-caps.py
+++ b/tests/twisted/simple-caps.py
@@ -6,9 +6,11 @@ Make sure ContactCaps works well enough.
 from twisted.words.xish import domish
 
 from servicetest import assertEquals, assertContains, EventPattern
-from hazetest import exec_test
+from hazetest import exec_test, sync_stream
 import constants as cs
 
+import config
+
 import ns
 
 # assert this list of RCCs is only text
@@ -68,7 +70,36 @@ def test_someone_else(q, bus, conn, stream):
     amy_handle = conn.RequestHandles(cs.HT_CONTACT, ['amy at foo.com'])[0]
     check_rccs(conn, amy_handle)
 
+def test_media(q, bus, conn, stream):
+    conn.Connect()
+    q.expect('dbus-signal', signal='StatusChanged',
+            args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
+
+    sync_stream(q, stream)
+
+    conn.ContactCapabilities.UpdateCapabilities([(
+                'im.telepathy1.Client.Foobar',
+                [{ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+                   cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+                   cs.INITIAL_AUDIO: True },
+                 { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+                   cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+                   cs.INITIAL_VIDEO: True }],
+                [],
+                )])
+
+    q.expect('stream-presence') # can't be bothered checking this
+
+    conn.ContactCapabilities.UpdateCapabilities([(
+                'im.telepathy1.Client.Foobar',
+                [], [])])
+
+    q.expect('stream-presence') # can't be bothered checking this
+
 if __name__ == '__main__':
     exec_test(test_self_handle)
     exec_test(test_someone_else)
 
+    if config.MEDIA_ENABLED:
+        exec_test(test_media)
+



More information about the telepathy-commits mailing list