[Telepathy-commits] [telepathy-gabble/master] Duplicate test-outgoing-call.py as test-outgoing-call-deprecated.py

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 19 10:51:59 PDT 2008


20080430160140-53eee-6ed4f66cbce210ad40b288ced8132f4e41728af6.gz
---
 tests/twisted/Makefile.am                          |    1 +
 .../jingle/test-outgoing-call-deprecated.py        |   93 ++++++++++++++++++++
 2 files changed, 94 insertions(+), 0 deletions(-)
 create mode 100644 tests/twisted/jingle/test-outgoing-call-deprecated.py

diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index a356468..b7b88f7 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -37,6 +37,7 @@ TWISTED_TESTS = \
 	jingle/hold-av.py \
 	jingle/test-incoming-call.py \
 	jingle/test-outgoing-call.py \
+	jingle/test-outgoing-call-deprecated.py \
 	jingle/test-outgoing-call-rejected.py \
 	test-capabilities.py \
 	test-caps-update.py \
diff --git a/tests/twisted/jingle/test-outgoing-call-deprecated.py b/tests/twisted/jingle/test-outgoing-call-deprecated.py
new file mode 100644
index 0000000..6242c25
--- /dev/null
+++ b/tests/twisted/jingle/test-outgoing-call-deprecated.py
@@ -0,0 +1,93 @@
+
+"""
+Test outgoing call handling. This tests the happy scenario
+when the remote party accepts the call.
+"""
+
+from gabbletest import exec_test, make_result_iq
+from servicetest import make_channel_proxy, unwrap, tp_path_prefix
+import jingletest
+import gabbletest
+import dbus
+import time
+
+
+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()
+
+    q.expect('dbus-signal', signal='StatusChanged', args=[1, 1])
+    q.expect('stream-authenticated')
+    q.expect('dbus-signal', signal='PresenceUpdate',
+        args=[{1L: (0L, {u'available': {}})}])
+    q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
+
+    # 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='foo at bar.com/Foo')
+
+    jt.send_remote_disco_reply(event.stanza)
+
+    handle = conn.RequestHandles(1, [jt.remote_jid])[0]
+
+    path = conn.RequestChannel(
+        'org.freedesktop.Telepathy.Channel.Type.StreamedMedia',
+        1, handle, True)
+
+    signalling_iface = make_channel_proxy(conn, path, 'Channel.Interface.MediaSignalling')
+    media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
+    group_iface = make_channel_proxy(conn, path, 'Channel.Interface.Group')
+
+    # S-E gets notified about new session handler, and calls Ready on it
+    e = q.expect('dbus-signal', signal='NewSessionHandler')
+    assert e.args[1] == 'rtp'
+
+    session_handler = make_channel_proxy(conn, e.args[0], 'Media.SessionHandler')
+    session_handler.Ready()
+
+
+    media_iface.RequestStreams(handle, [0]) # 0 == MEDIA_STREAM_TYPE_AUDIO
+
+    e = q.expect('dbus-signal', signal='NewStreamHandler')
+
+    stream_handler = make_channel_proxy(conn, e.args[0], 'Media.StreamHandler')
+
+    stream_handler.NewNativeCandidate("fake", jt.get_remote_transports_dbus())
+    stream_handler.Ready(jt.get_audio_codecs_dbus())
+    stream_handler.StreamState(2)
+
+    e = q.expect('stream-iq')
+    print e.iq_type, e.stanza
+    assert e.query.name == 'jingle'
+    assert e.query['action'] == 'session-initiate'
+    stream.send(gabbletest.make_result_iq(stream, e.stanza))
+
+    jt.outgoing_call_reply(e.query['sid'], True)
+
+    q.expect('stream-iq', iq_type='result')
+
+    # Time passes ... afterwards we close the chan
+
+    group_iface.RemoveMembers([dbus.UInt32(1)], 'closed')
+
+    # Test completed, close the connection
+
+    e = q.expect('dbus-signal', signal='Close') #XXX - match against the path
+
+    conn.Disconnect()
+    q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
+
+    return True
+
+
+if __name__ == '__main__':
+    exec_test(test)
+
-- 
1.5.6.3




More information about the Telepathy-commits mailing list