[tor-commits] [bridgedb/master] Add test for vanilla IPv6 addresses in test_https.py.

isis at torproject.org isis at torproject.org
Wed Mar 25 19:03:47 UTC 2015


commit c1a3d4692270b592a3a2efb7d5a14af357f6f91c
Author: Isis Lovecruft <isis at torproject.org>
Date:   Mon Mar 23 00:14:57 2015 +0000

    Add test for vanilla IPv6 addresses in test_https.py.
---
 lib/bridgedb/test/test_https.py |   23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/lib/bridgedb/test/test_https.py b/lib/bridgedb/test/test_https.py
index 6a40a67..92b07bf 100644
--- a/lib/bridgedb/test/test_https.py
+++ b/lib/bridgedb/test/test_https.py
@@ -216,6 +216,29 @@ class HTTPTests(unittest.TestCase):
             addr = bridge[0].rsplit(':', 1)[0]
             self.assertIsInstance(ipaddr.IPAddress(addr), ipaddr.IPv4Address)
 
+    def test_get_vanilla_ipv6(self):
+        if os.environ.get("CI"):
+            if not self.pid or not processExists(self.pid):
+                raise FailTest("Could not start BridgeDB process on CI server!")
+        else:
+            raise SkipTest(("The mechanize tests cannot handle self-signed  "
+                            "TLS certificates, and thus require opening "
+                            "another port for running a plaintext HTTP-only "
+                            "BridgeDB webserver. Because of this, these tests "
+                            "are only run on CI servers."))
+
+        self.openBrowser()
+        self.goToOptionsPage()
+
+        PT = '0'
+        soup = self.submitOptions(transport=PT, ipv6=True,
+                                  captchaResponse=CAPTCHA_RESPONSE)
+        bridges = self.getBridgeLinesFromSoup(soup, fieldsPerBridge=2)
+        for bridge in bridges:
+            self.assertTrue(bridge != None)
+            addr = bridge[0].rsplit(':', 1)[0].strip('[]')
+            self.assertIsInstance(ipaddr.IPAddress(addr), ipaddr.IPv6Address)
+
     def test_get_scramblesuit_ipv4(self):
         if os.environ.get("CI"):
             if not self.pid or not processExists(self.pid):





More information about the tor-commits mailing list