telepathy-gabble: tests: unduplicate fallback stun server check

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


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

Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Thu Nov 22 14:44:05 2012 +0000

tests: unduplicate fallback stun server check

---

 tests/twisted/jingle/stun-server.py |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/tests/twisted/jingle/stun-server.py b/tests/twisted/jingle/stun-server.py
index 54c52ba..2294c71 100644
--- a/tests/twisted/jingle/stun-server.py
+++ b/tests/twisted/jingle/stun-server.py
@@ -24,9 +24,9 @@ def test_stun_server(stun_server_prop,
         expected_stun_server=None, expected_stun_port=None):
     if expected_stun_server == None:
         # If there is no stun server set then gabble should fallback on the
-        # default fallback stunserver (stun.collabora.co.uk)
+        # default fallback stun server (stun.telepathy.im)
         # This test uses the test-resolver which is set to
-        # have 'stun.collabora.co.uk' resolve to '6.7.8.9'
+        # have 'stun.telepathy.im' resolve to '6.7.8.9'
         expected_stun_server = '6.7.8.9'
         expected_stun_port = 3478
 
@@ -128,21 +128,8 @@ def test_streamed_media(q, bus, conn, stream,
     assert sh_props['NATTraversal'] == 'gtalk-p2p'
     assert sh_props['CreatedLocally'] == False
 
-    if expected_stun_server == None:
-        # If there is no stun server set then gabble should fallback on the
-        # default fallback stunserver (stun.telepathy.im)
-        # This test uses the test-resolver which is set to
-        # have 'stun.telepathy.im' resolve to '6.7.8.9'
-        expected_stun_server = '6.7.8.9'
-        expected_stun_port = 3478
-
-    if expected_stun_server is None:
-        assert sh_props['STUNServers'] == [], sh_props['STUNServers']
-    else:
-        assert sh_props['STUNServers'] == \
-            [(expected_stun_server, expected_stun_port)], \
-            sh_props['STUNServers']
-
+    test_stun_server(sh_props['STUNServers'],
+        expected_stun_server, expected_stun_port)
     assert sh_props['RelayInfo'] == expected_relays
 
     # consistency check, since we currently reimplement Get separately



More information about the telepathy-commits mailing list