mirror of
https://github.com/python/cpython.git
synced 2025-09-03 23:41:18 +00:00
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>
This commit is contained in:
parent
17a544b257
commit
1ff1b899ce
6 changed files with 72 additions and 72 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue