[tor-commits] [bridgedb/master] Skip two unittests for SSLVerifyingContextFactory with Twisted>=14.0.0.

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


commit e6808c2e83269a25bfe71427b17991871a8eecf6
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed Mar 25 01:14:30 2015 +0000

    Skip two unittests for SSLVerifyingContextFactory with Twisted>=14.0.0.
---
 lib/bridgedb/test/test_crypto.py |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/lib/bridgedb/test/test_crypto.py b/lib/bridgedb/test/test_crypto.py
index 9fb0448..3264ace 100644
--- a/lib/bridgedb/test/test_crypto.py
+++ b/lib/bridgedb/test/test_crypto.py
@@ -23,7 +23,9 @@ import shutil
 
 import OpenSSL
 
+from twisted import version as _twistedversion
 from twisted.internet import defer
+from twisted.python.versions import Version
 from twisted.trial import unittest
 from twisted.test.proto_helpers import StringTransport
 from twisted.web.test import test_agent as txtagent
@@ -331,6 +333,14 @@ class SSLVerifyingContextFactoryTests(unittest.TestCase,
 
     def test_getHostnameFromURL(self):
         """``getHostnameFromURL()`` should return a hostname from a URI."""
+        if _twistedversion >= Version('twisted', 14, 0, 0):
+            raise unittest.SkipTest(
+                ("The SSLVerifyingContextFactory is no longer necessary in "
+                 "Twisted>=14.0.0, because the way in which TLS certificates "
+                 "are checked now includes certificate pinning, and the "
+                 "SSLVerifyingContextFactory only implemented strict hostname "
+                 "checking."))
+
         agent = txrecaptcha._getAgent(self.reactor, self.url)
         contextFactory = agent._contextFactory
         self.assertRegexpMatches(contextFactory.hostname,
@@ -341,6 +351,14 @@ class SSLVerifyingContextFactoryTests(unittest.TestCase,
         ``SSLVerifyingContextFactory.hostname`` does not match the one found
         in the level 0 certificate subject CN.
         """
+        if _twistedversion >= Version('twisted', 14, 0, 0):
+            raise unittest.SkipTest(
+                ("The SSLVerifyingContextFactory is no longer necessary in "
+                 "Twisted>=14.0.0, because the way in which TLS certificates "
+                 "are checked now includes certificate pinning, and the "
+                 "SSLVerifyingContextFactory only implemented strict hostname "
+                 "checking."))
+
         agent = txrecaptcha._getAgent(self.reactor, self.url)
         contextFactory = agent._contextFactory
         x509 = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,





More information about the tor-commits mailing list