diff options
author | Christian Heimes <christian@python.org> | 2017-09-15 18:27:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-15 18:27:30 (GMT) |
commit | a170fa162dc03f0a014373349e548954fff2e567 (patch) | |
tree | ed08062f8462d8b9e98e38b7832e39a85881b4e3 /Lib/test/test_poplib.py | |
parent | 4df60f18c64ba2835e68bf3eed08d8002a00f4ac (diff) | |
download | cpython-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_poplib.py')
-rw-r--r-- | Lib/test/test_poplib.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/test/test_poplib.py b/Lib/test/test_poplib.py index 721ea25..9ba678f 100644 --- a/Lib/test/test_poplib.py +++ b/Lib/test/test_poplib.py @@ -352,10 +352,10 @@ class TestPOP3Class(TestCase): @requires_ssl def test_stls_context(self): expected = b'+OK Begin TLS negotiation' - ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) + ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) ctx.load_verify_locations(CAFILE) - ctx.verify_mode = ssl.CERT_REQUIRED - ctx.check_hostname = True + self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) + self.assertEqual(ctx.check_hostname, True) with self.assertRaises(ssl.CertificateError): resp = self.client.stls(context=ctx) self.client = poplib.POP3("localhost", self.server.port, timeout=3) @@ -392,7 +392,9 @@ class TestPOP3_SSLClass(TestPOP3Class): self.assertIn('POP3_SSL', poplib.__all__) def test_context(self): - 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, poplib.POP3_SSL, self.server.host, self.server.port, keyfile=CERTFILE, context=ctx) self.assertRaises(ValueError, poplib.POP3_SSL, self.server.host, |