diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2013-09-29 19:50:53 +0200 |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2013-09-29 19:50:53 +0200 |
commit | 20b85557f2cc8f5f10d7d98314a3181c60553e12 (patch) | |
tree | 80ad5b16d5f0644f096a284d0b43fedb13630b21 /Lib/test/test_ssl.py | |
parent | cf892ace48721cb301d6f8d56ad8779bc13cb9de (diff) | |
download | cpython-git-20b85557f2cc8f5f10d7d98314a3181c60553e12.tar.gz |
Issue #19095: SSLSocket.getpeercert() now raises ValueError when the SSL handshake hasn't been done.
Diffstat (limited to 'Lib/test/test_ssl.py')
-rw-r--r-- | Lib/test/test_ssl.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 8915305213..2605e68cce 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -1588,8 +1588,14 @@ else: context.load_cert_chain(CERTFILE) server = ThreadedEchoServer(context=context, chatty=False) with server: - s = context.wrap_socket(socket.socket()) + s = context.wrap_socket(socket.socket(), + do_handshake_on_connect=False) s.connect((HOST, server.port)) + # getpeercert() raise ValueError while the handshake isn't + # done. + with self.assertRaises(ValueError): + s.getpeercert() + s.do_handshake() cert = s.getpeercert() self.assertTrue(cert, "Can't get peer certificate.") cipher = s.cipher() |