aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/utils.py
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2024-09-25 23:23:47 +0200
committerGitHub <noreply@github.com>2024-09-25 21:23:47 +0000
commit1ff1b899ce13b195d978736b78cd75ac021e64b5 (patch)
tree373b8f7ec76bc08e0e77031f3b49db606a453216 /Lib/test/test_asyncio/utils.py
parent17a544b257ee3aeaa525350717ee56fd409d9c08 (diff)
downloadcpython-1ff1b899ce13b195d978736b78cd75ac021e64b5.tar.gz
cpython-1ff1b899ce13b195d978736b78cd75ac021e64b5.zip
gh-119400: make_ssl_certs: update reference test data automatically, pass in expiration dates as parameters #119400 (GH-119401)
* Lib/test/certdata: do not hardcode reference cert data into tests The script was simply printing the reference data and asking users to update it by hand into the test suites. This can be easily improved by writing the data into files and having the test cases load the files. * make_ssl_certs: make it possible to pass in expiration dates from command line Note that in this commit, the defaults are same as they were, so if nothing is specified the script works as before. --------- Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r--Lib/test/test_asyncio/utils.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index 35893ab3118..b8dbe7feaac 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -15,6 +15,7 @@ import threading
import unittest
import weakref
import warnings
+from ast import literal_eval
from unittest import mock
from http.server import HTTPServer
@@ -56,24 +57,8 @@ ONLYCERT = data_file('certdata', 'ssl_cert.pem')
ONLYKEY = data_file('certdata', 'ssl_key.pem')
SIGNED_CERTFILE = data_file('certdata', 'keycert3.pem')
SIGNING_CA = data_file('certdata', 'pycacert.pem')
-PEERCERT = {
- 'OCSP': ('http://testca.pythontest.net/testca/ocsp/',),
- 'caIssuers': ('http://testca.pythontest.net/testca/pycacert.cer',),
- 'crlDistributionPoints': ('http://testca.pythontest.net/testca/revocation.crl',),
- 'issuer': ((('countryName', 'XY'),),
- (('organizationName', 'Python Software Foundation CA'),),
- (('commonName', 'our-ca-server'),)),
- 'notAfter': 'Oct 28 14:23:16 2037 GMT',
- 'notBefore': 'Aug 29 14:23:16 2018 GMT',
- 'serialNumber': 'CB2D80995A69525C',
- 'subject': ((('countryName', 'XY'),),
- (('localityName', 'Castle Anthrax'),),
- (('organizationName', 'Python Software Foundation'),),
- (('commonName', 'localhost'),)),
- 'subjectAltName': (('DNS', 'localhost'),),
- 'version': 3
-}
-
+with open(data_file('certdata', 'keycert3.pem.reference')) as file:
+ PEERCERT = literal_eval(file.read())
def simple_server_sslcontext():
server_context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)