telepathy-gabble: jingle/stun-server: remove unneeded do_connect=False

Will Thompson wjt at kemper.freedesktop.org
Thu Dec 6 04:29:02 PST 2012


Module: telepathy-gabble
Branch: master
Commit: a12bb8705eb0810b67f83dae7185a182bb1225bd
URL:    http://cgit.freedesktop.org/telepathy/telepathy-gabble/commit/?id=a12bb8705eb0810b67f83dae7185a182bb1225bd

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Thu Nov 22 16:21:35 2012 +0000

jingle/stun-server: remove unneeded do_connect=False

This used to be needed to ensure that the query Gabble sends right after
connecting wasn't swallowed by the expect() calls that gabbletest makes
after Connect(). But now that Sjoerd's split the dbus and stream event
queues, this is no longer a problem: the only stream event it awaits is
stream-authenticated, which is certainly before the jingleinfo query.

---

 tests/twisted/jingle/stun-server.py |   35 ++++++++++++-----------------------
 1 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/tests/twisted/jingle/stun-server.py b/tests/twisted/jingle/stun-server.py
index d4e7ca8..6fab4c8 100644
--- a/tests/twisted/jingle/stun-server.py
+++ b/tests/twisted/jingle/stun-server.py
@@ -40,21 +40,10 @@ def init_test(q, conn, stream, google=False):
     # If we need to override remote caps, feats, codecs or caps,
     # this is a good time to do it
 
-    # Connecting
-    conn.Connect()
-
-    expected = [EventPattern('dbus-signal', signal='StatusChanged',
-                args=[cs.CONN_STATUS_CONNECTED, cs.CSR_REQUESTED])]
-
     if google:
         # See: http://code.google.com/apis/talk/jep_extensions/jingleinfo.html
-        expected.append(EventPattern('stream-iq', query_ns=ns.GOOGLE_JINGLE_INFO,
-                to='test at localhost'))
-
-    events = q.expect_many(*expected)
-
-    if google:
-        event = events[-1]
+        event = q.expect('stream-iq', query_ns=ns.GOOGLE_JINGLE_INFO,
+            to='test at localhost')
         jingleinfo = make_result_iq(stream, event.stanza)
         stun = jingleinfo.firstChildElement().addElement('stun')
         server = stun.addElement('server')
@@ -270,38 +259,38 @@ def test_call(q, bus, conn, stream,
 if __name__ == '__main__':
     # StreamedMedia tests
     exec_test(partial(test_streamed_media,
-        google=False), do_connect=False)
+        google=False))
     exec_test(partial(test_streamed_media,
         google=False, expected_stun_server='5.4.3.2', expected_stun_port=54321),
         params={'fallback-stun-server': 'resolves-to-5.4.3.2',
-            'fallback-stun-port': dbus.UInt16(54321)}, do_connect=False)
+            'fallback-stun-port': dbus.UInt16(54321)})
 
     if GOOGLE_RELAY_ENABLED:
         exec_test(partial(test_streamed_media,
             google=True, expected_stun_server='1.2.3.4', expected_stun_port=12345),
-            protocol=GoogleXmlStream, do_connect=False)
+            protocol=GoogleXmlStream)
         exec_test(partial(test_streamed_media,
             google=True, expected_stun_server='5.4.3.2', expected_stun_port=54321),
             protocol=GoogleXmlStream,
             params={'stun-server': 'resolves-to-5.4.3.2',
-                'stun-port': dbus.UInt16(54321)}, do_connect=False)
+                'stun-port': dbus.UInt16(54321)})
         exec_test(partial(test_streamed_media,
             google=True, expected_stun_server='1.2.3.4', expected_stun_port=12345),
             protocol=GoogleXmlStream,
             params={'fallback-stun-server': 'resolves-to-5.4.3.2',
-                'fallback-stun-port': dbus.UInt16(54321)}, do_connect=False)
+                'fallback-stun-port': dbus.UInt16(54321)})
     else:
         print "NOTE: built with --disable-google-relay; omitting StreamedMedia tests with Google relay"
 
     # Call tests
     if CHANNEL_TYPE_CALL_ENABLED:
         exec_test(partial(test_call,
-            google=False), do_connect=False)
+            google=False))
         exec_test(partial(test_call,
             google=False, expected_stun_server='5.4.3.2',
             expected_stun_port=54321),
             params={'fallback-stun-server': 'resolves-to-5.4.3.2',
-                'fallback-stun-port': dbus.UInt16(54321)}, do_connect=False)
+                'fallback-stun-port': dbus.UInt16(54321)})
     else:
         print "NOTE: built with --disable-channel-type-call; omitting Call tests"
 
@@ -309,19 +298,19 @@ if __name__ == '__main__':
         exec_test(partial(test_call,
             google=True, expected_stun_server='1.2.3.4',
             expected_stun_port=12345),
-            protocol=GoogleXmlStream, do_connect=False)
+            protocol=GoogleXmlStream)
         exec_test(partial(test_call,
             google=True, expected_stun_server='5.4.3.2',
             expected_stun_port=54321),
             protocol=GoogleXmlStream,
             params={'stun-server': 'resolves-to-5.4.3.2',
-                'stun-port': dbus.UInt16(54321)}, do_connect=False)
+                'stun-port': dbus.UInt16(54321)})
         exec_test(partial(test_call,
             google=True, expected_stun_server='1.2.3.4',
             expected_stun_port=12345),
             protocol=GoogleXmlStream,
             params={'fallback-stun-server': 'resolves-to-5.4.3.2',
-                'fallback-stun-port': dbus.UInt16(54321)}, do_connect=False)
+                'fallback-stun-port': dbus.UInt16(54321)})
     else:
         print "NOTE: built with --disable-channel-type-call or with --disable-google-relay; omitting Call tests with Google relay"
 



More information about the telepathy-commits mailing list