[Python-checkins] cpython: Issue #28093: Check more invalid combinations of PROTOCOL_TLS_CLIENT /

christian.heimes python-checkins at python.org
Mon Sep 12 04:49:02 EDT 2016


https://hg.python.org/cpython/rev/cf2689e191f8
changeset:   103697:cf2689e191f8
parent:      103668:301a847890a3
user:        Christian Heimes <christian at python.org>
date:        Mon Sep 12 10:48:20 2016 +0200
summary:
  Issue #28093: Check more invalid combinations of PROTOCOL_TLS_CLIENT / PROTOCOL_TLS_SERVER

files:
  Lib/test/test_ssl.py |  26 +++++++++++++++++++++++---
  1 files changed, 23 insertions(+), 3 deletions(-)


diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -2305,18 +2305,38 @@
             # server_context.load_verify_locations(SIGNING_CA)
             server_context.load_cert_chain(SIGNED_CERTFILE2)
 
-            with self.subTest(client='PROTOCOL_TLS_CLIENT', server='PROTOCOL_TLS_SERVER'):
+            with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_SERVER):
                 server_params_test(client_context=client_context,
                                    server_context=server_context,
                                    chatty=True, connectionchatty=True,
                                    sni_name='fakehostname')
 
-            with self.subTest(client='PROTOCOL_TLS_SERVER', server='PROTOCOL_TLS_CLIENT'):
-                with self.assertRaises(ssl.SSLError):
+            client_context.check_hostname = False
+            with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_CLIENT):
+                with self.assertRaises(ssl.SSLError) as e:
                     server_params_test(client_context=server_context,
                                        server_context=client_context,
                                        chatty=True, connectionchatty=True,
                                        sni_name='fakehostname')
+                self.assertIn('called a function you should not call',
+                              str(e.exception))
+
+            with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_SERVER):
+                with self.assertRaises(ssl.SSLError) as e:
+                    server_params_test(client_context=server_context,
+                                       server_context=server_context,
+                                       chatty=True, connectionchatty=True)
+                self.assertIn('called a function you should not call',
+                              str(e.exception))
+
+            with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_CLIENT):
+                with self.assertRaises(ssl.SSLError) as e:
+                    server_params_test(client_context=server_context,
+                                       server_context=client_context,
+                                       chatty=True, connectionchatty=True)
+                self.assertIn('called a function you should not call',
+                              str(e.exception))
+
 
         def test_getpeercert(self):
             if support.verbose:

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list