[tor-commits] [bridgedb/master] Add unittest for PluggableTransport.getTransportLine() with IPv6 address.

isis at torproject.org isis at torproject.org
Sat Mar 21 02:03:00 UTC 2015


commit f78bea9e46270afa5a603c061ffa76238d83c2f9
Author: Isis Lovecruft <isis at torproject.org>
Date:   Sun Dec 28 12:43:16 2014 +0000

    Add unittest for PluggableTransport.getTransportLine() with IPv6 address.
---
 lib/bridgedb/test/test_bridges.py |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/bridgedb/test/test_bridges.py b/lib/bridgedb/test/test_bridges.py
index 794351f..c481578 100644
--- a/lib/bridgedb/test/test_bridges.py
+++ b/lib/bridgedb/test/test_bridges.py
@@ -627,6 +627,18 @@ class PluggableTransportTests(unittest.TestCase):
             ("password=unicorns sharedsecret=foobar" in bridgeLine) or
             ("sharedsecret=foobar password=unicorns" in bridgeLine))
 
+    def test_PluggableTransport_getTransportLine_IPv6(self):
+        """The address portion of a bridge line with an IPv6 address should
+        have square brackets around it.
+        """
+        pt = bridges.PluggableTransport(self.fingerprint,
+                                        "voltronPT", "2006:42::1234", 443,
+                                        {'sharedsecret': 'foobar',
+                                         'password': 'unicorns'})
+        bridgeLine = pt.getTransportLine()
+        self.assertEqual(pt.address.version, 6)
+        self.assertIn("[2006:42::1234]:443", bridgeLine)
+
 
 class BridgeBackwardsCompatibilityTests(unittest.TestCase):
     """Tests for :class:`bridgedb.bridges.BridgeBackwardsCompatibility`."""





More information about the tor-commits mailing list