[telepathy-gabble/master] Add test for basic construction of a Call channel
Sjoerd Simons
sjoerd.simons at collabora.co.uk
Tue Dec 29 05:34:36 PST 2009
---
tests/twisted/Makefile.am | 1 +
tests/twisted/jingle/call-outgoing-basics.py | 57 ++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)
create mode 100644 tests/twisted/jingle/call-outgoing-basics.py
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index ba2e5b9..24bad3a 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -100,6 +100,7 @@ TWISTED_TESTS = \
vcard/update-rejected.py \
jingle/accept-extra-stream.py \
jingle/call-state.py \
+ jingle/call-outgoing-basics.py
jingle/google-relay.py \
jingle/hold-audio.py \
jingle/hold-av.py \
diff --git a/tests/twisted/jingle/call-outgoing-basics.py b/tests/twisted/jingle/call-outgoing-basics.py
new file mode 100644
index 0000000..abf5ad3
--- /dev/null
+++ b/tests/twisted/jingle/call-outgoing-basics.py
@@ -0,0 +1,57 @@
+"""
+Test basic outgoing call handling, using CreateChannel
+"""
+
+import dbus
+from twisted.words.xish import xpath
+
+from gabbletest import exec_test
+from servicetest import (
+ make_channel_proxy, wrap_channel,
+ EventPattern, call_async,
+ assertEquals, assertContains, assertLength,
+ )
+import constants as cs
+from jingletest2 import JingleTest2, test_all_dialects
+
+def run_test(jp, q, bus, conn, stream):
+ jt2 = JingleTest2(jp, conn, q, stream, 'test at localhost', 'foo at bar.com/Foo')
+ jt2.prepare()
+
+ self_handle = conn.GetSelfHandle()
+ remote_handle = conn.RequestHandles(1, ["foo at bar.com/Foo"])[0]
+
+ # Ensure a channel that doesn't exist yet.
+ call_async(q, conn.Requests, 'CreateChannel',
+ { cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_CALL,
+ cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+ cs.TARGET_HANDLE: remote_handle,
+ cs.CALL_INITIAL_AUDIO: True,
+ })
+
+ ret, signal = q.expect_many(
+ EventPattern('dbus-return', method='CreateChannel'),
+ EventPattern('dbus-signal', signal='NewChannels'),
+ )
+
+ assertLength(1, signal.args)
+ assertLength(1, signal.args[0]) # one channel
+ assertLength(2, signal.args[0][0]) # two struct members
+ emitted_props = signal.args[0][0][1]
+
+ assertEquals(
+ cs.CHANNEL_TYPE_CALL, emitted_props[cs.CHANNEL_TYPE])
+
+ assertEquals(remote_handle, emitted_props[cs.TARGET_HANDLE])
+ assertEquals(cs.HT_CONTACT, emitted_props[cs.TARGET_HANDLE_TYPE])
+ assertEquals('foo at bar.com', emitted_props[cs.TARGET_ID])
+
+ assertEquals(True, emitted_props[cs.REQUESTED])
+ assertEquals(self_handle, emitted_props[cs.INITIATOR_HANDLE])
+ assertEquals('test at localhost', emitted_props[cs.INITIATOR_ID])
+
+ assertEquals(True, emitted_props[cs.CALL_INITIAL_AUDIO])
+ assertEquals(False, emitted_props[cs.CALL_INITIAL_VIDEO])
+
+if __name__ == '__main__':
+ test_all_dialects(run_test)
--
1.5.6.5
More information about the telepathy-commits
mailing list