[telepathy-gabble/master] Expect ice-udp candidates in session-initiate.
Will Thompson
will.thompson at collabora.co.uk
Sat Jun 27 03:50:19 PDT 2009
The test previously expected an empty <transport/> stanza in the
session-initiate, followed by a transport-info action containing the
candidate. This matches gtalk-p2p, and is permitted by XEP-0176, but the
latter says the session-initiate SHOULD contain candidates.
So, test that the session-initiate contains the candidate we gave
Gabble, and also check that Gabble doesn't send a bonus empty
transport-info.
---
tests/twisted/jingle/test-outgoing-iceudp.py | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/tests/twisted/jingle/test-outgoing-iceudp.py b/tests/twisted/jingle/test-outgoing-iceudp.py
index 6cfee18..56536b5 100644
--- a/tests/twisted/jingle/test-outgoing-iceudp.py
+++ b/tests/twisted/jingle/test-outgoing-iceudp.py
@@ -2,7 +2,7 @@
Test outgoing call using ICE-UDP transport mechanism.
"""
-from gabbletest import exec_test
+from gabbletest import exec_test, sync_stream
from servicetest import (
wrap_channel, make_channel_proxy, EventPattern, call_async,
assertEquals)
@@ -55,22 +55,30 @@ def worker(jp, q, bus, conn, stream):
stream_handler.StreamState(2)
e = q.expect('stream-iq', predicate=jp.action_predicate('session-initiate'))
- assert xpath.queryForNodes("/iq/jingle/content/transport[@xmlns='%s']" %
- ns.JINGLE_TRANSPORT_ICEUDP, e.stanza)
- jt2.parse_session_initiate(e.query)
-
- stream.send(jp.xml(jp.ResultIq('test at localhost', e.stanza, [])))
-
- e = q.expect('stream-iq', predicate=jp.action_predicate('transport-info'))
+ # The session-initiate "MUST include a <transport/> child element qualified
+ # by the [ice-udp] namespace"
node = xpath.queryForNodes("/iq/jingle/content/transport[@xmlns='%s']" %
ns.JINGLE_TRANSPORT_ICEUDP, e.stanza)[0]
+ jt2.parse_session_initiate(e.query)
+ # ...which SHOULD contain the higher-priority ICE candidates. We supplied
+ # one candidate, so...
assertEquals('username', node['ufrag'])
assertEquals('password', node['pwd'])
node = [ x for x in node.children if type(x) != unicode ][0]
assertEquals('candidate', node.name)
assert node['foundation'] is not None
+ stream.send(jp.xml(jp.ResultIq('test at localhost', e.stanza, [])))
+
+ ti_event = [
+ EventPattern('stream-iq',
+ predicate=jp.action_predicate('transport-info'))
+ ]
+ q.forbid_events(ti_event)
+ sync_stream(q, stream)
+ q.unforbid_events(ti_event)
+
node = jp.SetIq(jt2.peer, jt2.jid, [
jp.Jingle(jt2.sid, jt2.peer, 'session-accept', [
jp.Content('stream1', 'initiator', 'both', [
--
1.5.6.5
More information about the telepathy-commits
mailing list