summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_ftplib.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_ftplib.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_ftplib.py')
-rw-r--r--Lib/test/test_ftplib.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/Lib/test/test_ftplib.py b/Lib/test/test_ftplib.py
index 5880a1e..f1b0185 100644
--- a/Lib/test/test_ftplib.py
+++ b/Lib/test/test_ftplib.py
@@ -902,17 +902,11 @@ class TestTLS_FTPClass(TestCase):
self.client.auth()
self.assertRaises(ValueError, self.client.auth)
- def test_auth_ssl(self):
- try:
- self.client.ssl_version = ssl.PROTOCOL_SSLv23
- self.client.auth()
- self.assertRaises(ValueError, self.client.auth)
- finally:
- self.client.ssl_version = ssl.PROTOCOL_TLSv1
-
def test_context(self):
self.client.quit()
- ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
+ ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ ctx.check_hostname = False
+ ctx.verify_mode = ssl.CERT_NONE
self.assertRaises(ValueError, ftplib.FTP_TLS, keyfile=CERTFILE,
context=ctx)
self.assertRaises(ValueError, ftplib.FTP_TLS, certfile=CERTFILE,
@@ -941,9 +935,9 @@ class TestTLS_FTPClass(TestCase):
def test_check_hostname(self):
self.client.quit()
- ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
- ctx.verify_mode = ssl.CERT_REQUIRED
- ctx.check_hostname = True
+ ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
+ self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED)
+ self.assertEqual(ctx.check_hostname, True)
ctx.load_verify_locations(CAFILE)
self.client = ftplib.FTP_TLS(context=ctx, timeout=TIMEOUT)