telepathy-gabble: jingle/outgoing-many-streams: use jingletest2

Will Thompson wjt at kemper.freedesktop.org
Thu Dec 6 04:46:04 PST 2012


Module: telepathy-gabble
Branch: master
Commit: 804cf93f08c79b400cdca43b45895b2922f05464
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=804cf93f08c79b400cdca43b45895b2922f05464

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Sat Nov 24 13:34:46 2012 +0000

jingle/outgoing-many-streams: use jingletest2

---

 tests/twisted/jingle/outgoing-many-streams.py |   27 ++++++++----------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/tests/twisted/jingle/outgoing-many-streams.py b/tests/twisted/jingle/outgoing-many-streams.py
index ecdcf11..b93ce61 100644
--- a/tests/twisted/jingle/outgoing-many-streams.py
+++ b/tests/twisted/jingle/outgoing-many-streams.py
@@ -9,7 +9,7 @@ import dbus
 from gabbletest import exec_test, sync_stream
 from servicetest import (
     make_channel_proxy, call_async, EventPattern)
-import jingletest
+import jingletest2
 import gabbletest
 
 import constants as cs
@@ -25,23 +25,13 @@ def test(q, bus, conn, stream):
     worker(q, bus, conn, stream, 'foo at sip.bar.com')
 
 def worker(q, bus, conn, stream, peer):
-    jt = jingletest.JingleTest(stream, 'test at localhost', peer)
+    jp = jingletest2.JingleProtocol031()
+    jt = jingletest2.JingleTest2(jp, conn, q, stream, 'test at localhost', peer)
 
     self_handle = conn.GetSelfHandle()
+    jt.send_presence_and_caps()
 
-    # We need remote end's presence for capabilities
-    jt.send_remote_presence()
-
-    # Gabble doesn't trust it, so makes a disco
-    event = q.expect('stream-iq', query_ns='http://jabber.org/protocol/disco#info',
-             to=jt.remote_jid)
-
-    jt.send_remote_disco_reply(event.stanza)
-
-    # Force Gabble to process the caps before calling RequestChannel
-    sync_stream(q, stream)
-
-    handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
+    handle = conn.RequestHandles(cs.HT_CONTACT, [jt.peer])[0]
 
     call_async(q, conn.Requests, 'CreateChannel',
             { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
@@ -77,7 +67,7 @@ def worker(q, bus, conn, stream, peer):
     assert emitted_props[cs.CHANNEL_TYPE] == cs.CHANNEL_TYPE_STREAMED_MEDIA
     assert emitted_props[cs.TARGET_HANDLE_TYPE] == cs.HT_CONTACT
     assert emitted_props[cs.TARGET_HANDLE] == handle
-    assert emitted_props[cs.TARGET_ID] == jt.remote_bare_jid, emitted_props
+    assert emitted_props[cs.TARGET_ID] == jt.peer_bare_jid, emitted_props
     assert emitted_props[cs.REQUESTED] == True
     assert emitted_props[cs.INITIATOR_HANDLE] == self_handle
     assert emitted_props[cs.INITIATOR_ID]  == 'test at localhost'
@@ -103,7 +93,7 @@ def worker(q, bus, conn, stream, peer):
               cs.TP_AWKWARD_PROPERTIES, cs.CHANNEL_IFACE_HOLD]:
         assert i in interfaces, (i, interfaces)
 
-    assert channel_props['TargetID'] == jt.remote_bare_jid, channel_props
+    assert channel_props['TargetID'] == jt.peer_bare_jid, channel_props
     assert channel_props['Requested'] == True
     assert channel_props['InitiatorID'] == 'test at localhost'
     assert channel_props['InitiatorHandle'] == self_handle
@@ -205,8 +195,9 @@ def worker(q, bus, conn, stream, peer):
     assert e.query.name == 'jingle'
     assert e.query['action'] == 'session-initiate'
     stream.send(gabbletest.make_result_iq(stream, e.stanza))
+    jt.parse_session_initiate(e.query)
 
-    jt.outgoing_call_reply(e.query['sid'], True)
+    jt.accept()
 
     q.expect('stream-iq', iq_type='result')
 



More information about the telepathy-commits mailing list