summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_imaplib.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2017-09-15 18:27:30 (GMT)
committerGitHub <noreply@github.com>2017-09-15 18:27:30 (GMT)
commita170fa162dc03f0a014373349e548954fff2e567 (patch)
treeed08062f8462d8b9e98e38b7832e39a85881b4e3 /Lib/test/test_imaplib.py
parent4df60f18c64ba2835e68bf3eed08d8002a00f4ac (diff)
downloadcpython-a170fa162dc03f0a014373349e548954fff2e567.zip
cpython-a170fa162dc03f0a014373349e548954fff2e567.tar.gz
cpython-a170fa162dc03f0a014373349e548954fff2e567.tar.bz2
bpo-31346: Use PROTOCOL_TLS_CLIENT/SERVER (#3058)
Replaces PROTOCOL_TLSv* and PROTOCOL_SSLv23 with PROTOCOL_TLS_CLIENT and PROTOCOL_TLS_SERVER. Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'Lib/test/test_imaplib.py')
-rw-r--r--Lib/test/test_imaplib.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/Lib/test/test_imaplib.py b/Lib/test/test_imaplib.py
index 2b62b05..4a45be6 100644
--- a/Lib/test/test_imaplib.py
+++ b/Lib/test/test_imaplib.py
@@ -479,9 +479,9 @@ class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase):
server_class = SecureTCPServer
def test_ssl_raises(self):
- ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- ssl_context.verify_mode = ssl.CERT_REQUIRED
- ssl_context.check_hostname = True
+ ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ self.assertEqual(ssl_context.verify_mode, ssl.CERT_REQUIRED)
+ self.assertEqual(ssl_context.check_hostname, True)
ssl_context.load_verify_locations(CAFILE)
with self.assertRaisesRegex(ssl.CertificateError,
@@ -492,9 +492,7 @@ class NewIMAPSSLTests(NewIMAPTestsMixin, unittest.TestCase):
client.shutdown()
def test_ssl_verified(self):
- ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- ssl_context.verify_mode = ssl.CERT_REQUIRED
- ssl_context.check_hostname = True
+ ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ssl_context.load_verify_locations(CAFILE)
_, server = self._setup(SimpleIMAPHandler)
@@ -871,9 +869,7 @@ class ThreadedNetworkedTestsSSL(ThreadedNetworkedTests):
@reap_threads
def test_ssl_verified(self):
- ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
- ssl_context.verify_mode = ssl.CERT_REQUIRED
- ssl_context.check_hostname = True
+ ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ssl_context.load_verify_locations(CAFILE)
with self.assertRaisesRegex(
@@ -953,7 +949,9 @@ class RemoteIMAP_SSLTest(RemoteIMAPTest):
pass
def create_ssl_context(self):
- ssl_context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
+ ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ ssl_context.check_hostname = False
+ ssl_context.verify_mode = ssl.CERT_NONE
ssl_context.load_cert_chain(CERTFILE)
return ssl_context