[telepathy-gabble/master] Add incoming_call() helper to JingleTest2

Will Thompson will.thompson at collabora.co.uk
Thu Mar 26 08:54:42 PDT 2009


---
 tests/twisted/jingle/jingletest2.py            |   11 +++++++++++
 tests/twisted/jingle/test-content-complex.py   |   10 +---------
 tests/twisted/jingle/test-dialects-incoming.py |   10 +---------
 3 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/tests/twisted/jingle/jingletest2.py b/tests/twisted/jingle/jingletest2.py
index 27cce16..b7c7597 100644
--- a/tests/twisted/jingle/jingletest2.py
+++ b/tests/twisted/jingle/jingletest2.py
@@ -325,6 +325,17 @@ class JingleTest2:
         # Force Gabble to process the caps before doing any more Jingling
         sync_stream(self.q, self.stream)
 
+    def incoming_call(self):
+        jp = self.jp
+        node = jp.SetIq(self.peer, self.jid, [
+            jp.Jingle(self.sid, self.peer, 'session-initiate', [
+                jp.Content('stream1', 'initiator', 'both', [
+                    jp.Description('audio', [
+                        jp.PayloadType(name, str(rate), str(id)) for
+                            (name, id, rate) in self.audio_codecs ]),
+                jp.TransportGoogleP2P() ]) ]) ])
+        self.stream.send(jp.xml(node))
+
     def set_sid_from_initiate(self, query):
         self.sid = self.jp.extract_session_id(query)
 
diff --git a/tests/twisted/jingle/test-content-complex.py b/tests/twisted/jingle/test-content-complex.py
index 31363a7..6b9b7db 100644
--- a/tests/twisted/jingle/test-content-complex.py
+++ b/tests/twisted/jingle/test-content-complex.py
@@ -37,15 +37,7 @@ def worker(jp, q, bus, conn, stream):
     remote_handle = conn.RequestHandles(cs.HT_CONTACT, ["foo at bar.com/Foo"])[0]
 
     # Remote end calls us
-    # jt.incoming_call()
-    node = jp.SetIq(jt2.peer, jt2.jid, [
-        jp.Jingle(jt2.sid, jt2.peer, 'session-initiate', [
-            jp.Content('stream1', 'initiator', 'both', [
-                jp.Description('audio', [
-                    jp.PayloadType(name, str(rate), str(id)) for
-                        (name, id, rate) in jt2.audio_codecs ]),
-            jp.TransportGoogleP2P() ]) ]) ])
-    stream.send(jp.xml(node))
+    jt2.incoming_call()
 
     # FIXME: these signals are not observable by real clients, since they
     #        happen before NewChannels.
diff --git a/tests/twisted/jingle/test-dialects-incoming.py b/tests/twisted/jingle/test-dialects-incoming.py
index e2ec39b..1a4f63a 100644
--- a/tests/twisted/jingle/test-dialects-incoming.py
+++ b/tests/twisted/jingle/test-dialects-incoming.py
@@ -23,15 +23,7 @@ def worker(jp, q, bus, conn, stream):
     remote_handle = conn.RequestHandles(cs.HT_CONTACT, ["foo at bar.com/Foo"])[0]
 
     # Remote end calls us
-    # jt.incoming_call()
-    node = jp.SetIq(jt2.peer, jt2.jid, [
-        jp.Jingle(jt2.sid, jt2.peer, 'session-initiate', [
-            jp.Content('stream1', 'initiator', 'both', [
-                jp.Description('audio', [
-                    jp.PayloadType(name, str(rate), str(id)) for
-                        (name, id, rate) in jt2.audio_codecs ]),
-            jp.TransportGoogleP2P() ]) ]) ])
-    stream.send(jp.xml(node))
+    jt2.incoming_call()
 
     # we don't even need this here, because we've provided a very strict
     # predicate to expect_racy() so it won't get the wrong event
-- 
1.5.6.5




More information about the telepathy-commits mailing list