[telepathy-gabble/master] various Jingle tests: test calls to/from bare JIDs where we have presence
Simon McVittie
simon.mcvittie at collabora.co.uk
Tue Jan 5 11:29:34 PST 2010
---
tests/twisted/jingle/accept-extra-stream.py | 8 +++++-
tests/twisted/jingle/incoming-basics.py | 6 +++-
tests/twisted/jingle/outgoing-basics.py | 32 ++++++++++++++++--------
tests/twisted/jingle/outgoing-ensure.py | 5 +++-
tests/twisted/jingle/outgoing-many-streams.py | 10 ++++---
5 files changed, 42 insertions(+), 19 deletions(-)
diff --git a/tests/twisted/jingle/accept-extra-stream.py b/tests/twisted/jingle/accept-extra-stream.py
index 957b7b1..5d4cb78 100644
--- a/tests/twisted/jingle/accept-extra-stream.py
+++ b/tests/twisted/jingle/accept-extra-stream.py
@@ -12,7 +12,12 @@ import constants as cs
from jingletest2 import JingleProtocol031, JingleTest2
def test(q, bus, conn, stream):
- remote_jid = 'foo at bar.com/Foo'
+ worker(q, bus, conn, stream, remote_jid='foo at bar.com/Foo')
+
+def test_bare_jid(q, bus, conn, stream):
+ worker(q, bus, conn, stream, remote_jid='foo at sip.bar.com')
+
+def worker(q, bus, conn, stream, remote_jid):
jp = JingleProtocol031()
jt2 = JingleTest2(jp, conn, q, stream, 'test at localhost', remote_jid)
jt2.prepare()
@@ -183,3 +188,4 @@ def test(q, bus, conn, stream):
if __name__ == '__main__':
exec_test(test)
+ exec_test(test_bare_jid)
diff --git a/tests/twisted/jingle/incoming-basics.py b/tests/twisted/jingle/incoming-basics.py
index ba95f6d..ab5418c 100644
--- a/tests/twisted/jingle/incoming-basics.py
+++ b/tests/twisted/jingle/incoming-basics.py
@@ -12,8 +12,8 @@ import constants as cs
from twisted.words.xish import xpath
-def test(jp, q, bus, conn, stream):
- jt = JingleTest2(jp, conn, q, stream, 'test at localhost', 'foo at bar.com/Foo')
+def test(jp, q, bus, conn, stream, peer='foo at bar.com/Foo'):
+ jt = JingleTest2(jp, conn, q, stream, 'test at localhost', peer)
jt.prepare()
self_handle = conn.GetSelfHandle()
@@ -180,3 +180,5 @@ def test(jp, q, bus, conn, stream):
if __name__ == '__main__':
test_all_dialects(test)
+ test_all_dialects(lambda jp, q, bus, conn, stream:
+ test(jp, q, bus, conn, stream, 'foo at sip.bar.com'))
diff --git a/tests/twisted/jingle/outgoing-basics.py b/tests/twisted/jingle/outgoing-basics.py
index fefd3f6..46caab1 100644
--- a/tests/twisted/jingle/outgoing-basics.py
+++ b/tests/twisted/jingle/outgoing-basics.py
@@ -26,20 +26,21 @@ REQUEST_ANONYMOUS_AND_ADD = 2 # RequestChannel(HandleTypeNone, 0);
REQUEST_NONYMOUS = 3 # RequestChannel(HandleTypeContact, h);
# RequestStreams(h, ...)
-def create(jp, q, bus, conn, stream):
- worker(jp, q, bus, conn, stream, CREATE)
+def create(jp, q, bus, conn, stream, peer='foo at bar.com/Res'):
+ worker(jp, q, bus, conn, stream, CREATE, peer)
-def request_anonymous(jp, q, bus, conn, stream):
- worker(jp, q, bus, conn, stream, REQUEST_ANONYMOUS)
+def request_anonymous(jp, q, bus, conn, stream, peer='foo at bar.com/Res'):
+ worker(jp, q, bus, conn, stream, REQUEST_ANONYMOUS, peer)
-def request_anonymous_and_add(jp, q, bus, conn, stream):
- worker(jp, q, bus, conn, stream, REQUEST_ANONYMOUS_AND_ADD)
+def request_anonymous_and_add(jp, q, bus, conn, stream,
+ peer='foo at bar.com/Res'):
+ worker(jp, q, bus, conn, stream, REQUEST_ANONYMOUS_AND_ADD, peer)
-def request_nonymous(jp, q, bus, conn, stream):
- worker(jp, q, bus, conn, stream, REQUEST_NONYMOUS)
+def request_nonymous(jp, q, bus, conn, stream, peer='foo at bar.com/Res'):
+ worker(jp, q, bus, conn, stream, REQUEST_NONYMOUS, peer)
-def worker(jp, q, bus, conn, stream, variant):
- jt2 = JingleTest2(jp, conn, q, stream, 'test at localhost', 'foo at bar.com/Foo')
+def worker(jp, q, bus, conn, stream, variant, peer):
+ jt2 = JingleTest2(jp, conn, q, stream, 'test at localhost', peer)
jt2.prepare()
self_handle = conn.GetSelfHandle()
@@ -52,7 +53,7 @@ def worker(jp, q, bus, conn, stream, variant):
path = conn.Requests.CreateChannel({
cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
- cs.TARGET_HANDLE: handle,
+ cs.TARGET_HANDLE: remote_handle,
})[0]
else:
path = conn.RequestChannel(cs.CHANNEL_TYPE_STREAMED_MEDIA,
@@ -309,6 +310,15 @@ def rccs(q, bus, conn, stream):
if __name__ == '__main__':
exec_test(rccs)
+ test_all_dialects(create)
test_all_dialects(request_anonymous)
test_all_dialects(request_anonymous_and_add)
test_all_dialects(request_nonymous)
+ test_all_dialects(lambda j, q, b, c, s:
+ create(j, q, b, c, s, peer='foo at gw.bar.com'))
+ test_all_dialects(lambda j, q, b, c, s:
+ request_anonymous(j, q, b, c, s, peer='foo at gw.bar.com'))
+ test_all_dialects(lambda j, q, b, c, s:
+ request_anonymous_and_add(j, q, b, c, s, peer='foo at gw.bar.com'))
+ test_all_dialects(lambda j, q, b, c, s:
+ request_nonymous(j, q, b, c, s, peer='foo at gw.bar.com'))
diff --git a/tests/twisted/jingle/outgoing-ensure.py b/tests/twisted/jingle/outgoing-ensure.py
index a3a4335..79ef0bf 100644
--- a/tests/twisted/jingle/outgoing-ensure.py
+++ b/tests/twisted/jingle/outgoing-ensure.py
@@ -1,6 +1,9 @@
"""
Test making outgoing calls using EnsureChannel, and retrieving existing calls
using EnsureChannel.
+
+This also exercises calls to a contact on a SIP gateway, who has no resource,
+only a bare JID.
"""
from gabbletest import exec_test
@@ -15,7 +18,7 @@ from jingletest2 import JingleProtocol031, JingleTest2
def test(q, bus, conn, stream):
jt = JingleTest2(JingleProtocol031(), conn, q, stream, 'test at localhost',
- 'foo at bar.com/Foo')
+ 'foo at sip.bar.com')
jt.prepare()
self_handle = conn.GetSelfHandle()
diff --git a/tests/twisted/jingle/outgoing-many-streams.py b/tests/twisted/jingle/outgoing-many-streams.py
index b855b09..1c85b60 100644
--- a/tests/twisted/jingle/outgoing-many-streams.py
+++ b/tests/twisted/jingle/outgoing-many-streams.py
@@ -15,10 +15,6 @@ import gabbletest
import constants as cs
def test(q, bus, conn, stream):
- jt = jingletest.JingleTest(stream, 'test at localhost', 'foo at bar.com/Foo')
-
- # If we need to override remote caps, feats, codecs or caps,
- # this is a good time to do it
# Connecting
conn.Connect()
@@ -32,6 +28,12 @@ def test(q, bus, conn, stream):
q.expect('dbus-signal', signal='StatusChanged',
args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])
+ worker(q, bus, conn, stream, 'foo at bar.com/Foo')
+ 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)
+
self_handle = conn.GetSelfHandle()
# We need remote end's presence for capabilities
--
1.5.6.5
More information about the telepathy-commits
mailing list