summaryrefslogtreecommitdiffstats
path: root/Doc/library/ssl.rst
diff options
context:
space:
mode:
authorMarco Buttu <marco.buttu@gmail.com>2017-04-13 14:17:59 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2017-04-13 14:17:59 (GMT)
commit7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982 (patch)
treea36719b82f5922e0102d2a0b4bbb5686b50ba045 /Doc/library/ssl.rst
parentd1dc65dc820649e59633142a88eaf97f930963a9 (diff)
downloadcpython-7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982.zip
cpython-7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982.tar.gz
cpython-7b2491a6aa5cdc1f8f9e3fd9df91f29ee69aa982.tar.bz2
bpo-27200: Fix pathlib, ssl, turtle and weakref doctests (GH-616)
Diffstat (limited to 'Doc/library/ssl.rst')
-rw-r--r--Doc/library/ssl.rst15
1 files changed, 11 insertions, 4 deletions
diff --git a/Doc/library/ssl.rst b/Doc/library/ssl.rst
index bbb1374..e394519 100644
--- a/Doc/library/ssl.rst
+++ b/Doc/library/ssl.rst
@@ -369,6 +369,10 @@ Random generation
Certificate handling
^^^^^^^^^^^^^^^^^^^^
+.. testsetup::
+
+ import ssl
+
.. function:: match_hostname(cert, hostname)
Verify that *cert* (in decoded format as returned by
@@ -415,10 +419,10 @@ Certificate handling
>>> import ssl
>>> timestamp = ssl.cert_time_to_seconds("Jan 5 09:34:43 2018 GMT")
- >>> timestamp
+ >>> timestamp # doctest: +SKIP
1515144883
>>> from datetime import datetime
- >>> print(datetime.utcfromtimestamp(timestamp))
+ >>> print(datetime.utcfromtimestamp(timestamp)) # doctest: +SKIP
2018-01-05 09:34:43
"notBefore" or "notAfter" dates must use GMT (:rfc:`5280`).
@@ -1378,6 +1382,7 @@ to speed up repeated connections from the same clients.
'strength_bits': 128}]
On OpenSSL 1.1 and newer the cipher dict contains additional fields::
+
>>> ctx.get_ciphers() # OpenSSL 1.1+
[{'aead': True,
'alg_bits': 256,
@@ -1638,7 +1643,7 @@ to speed up repeated connections from the same clients.
.. versionchanged:: 3.6
:attr:`SSLContext.options` returns :class:`Options` flags:
- >>> ssl.create_default_context().options
+ >>> ssl.create_default_context().options # doctest: +SKIP
<Options.OP_ALL|OP_NO_SSLv3|OP_NO_SSLv2|OP_NO_COMPRESSION: 2197947391>
.. attribute:: SSLContext.protocol
@@ -1658,7 +1663,7 @@ to speed up repeated connections from the same clients.
.. versionchanged:: 3.6
:attr:`SSLContext.verify_flags` returns :class:`VerifyFlags` flags:
- >>> ssl.create_default_context().verify_flags
+ >>> ssl.create_default_context().verify_flags # doctest: +SKIP
<VerifyFlags.VERIFY_X509_TRUSTED_FIRST: 32768>
.. attribute:: SSLContext.verify_mode
@@ -2259,6 +2264,8 @@ recommended to use :const:`PROTOCOL_TLS_CLIENT` or
:const:`PROTOCOL_TLS_SERVER` as the protocol version. SSLv2 and SSLv3 are
disabled by default.
+::
+
>>> client_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
>>> client_context.options |= ssl.OP_NO_TLSv1
>>> client_context.options |= ssl.OP_NO_TLSv1_1