Skip to content

Commit e5b4fee

Browse files
author
Martin Panter
committed
Issue #25940: Update new SSL tests for self-signed.pythontest.net
1 parent b644e8c commit e5b4fee

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Lib/test/test_ssl.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -971,7 +971,7 @@ def test_cert_store_stats(self):
971971
ctx.load_verify_locations(CERTFILE)
972972
self.assertEqual(ctx.cert_store_stats(),
973973
{'x509_ca': 0, 'crl': 0, 'x509': 1})
974-
ctx.load_verify_locations(SVN_PYTHON_ORG_ROOT_CERT)
974+
ctx.load_verify_locations(CAFILE_CACERT)
975975
self.assertEqual(ctx.cert_store_stats(),
976976
{'x509_ca': 1, 'crl': 0, 'x509': 2})
977977

@@ -981,8 +981,8 @@ def test_get_ca_certs(self):
981981
# CERTFILE is not flagged as X509v3 Basic Constraints: CA:TRUE
982982
ctx.load_verify_locations(CERTFILE)
983983
self.assertEqual(ctx.get_ca_certs(), [])
984-
# but SVN_PYTHON_ORG_ROOT_CERT is a CA cert
985-
ctx.load_verify_locations(SVN_PYTHON_ORG_ROOT_CERT)
984+
# but CAFILE_CACERT is a CA cert
985+
ctx.load_verify_locations(CAFILE_CACERT)
986986
self.assertEqual(ctx.get_ca_certs(),
987987
[{'issuer': ((('organizationName', 'Root CA'),),
988988
(('organizationalUnitName', 'http://www.cacert.org'),),
@@ -998,7 +998,7 @@ def test_get_ca_certs(self):
998998
(('emailAddress', '[email protected]'),)),
999999
'version': 3}])
10001000

1001-
with open(SVN_PYTHON_ORG_ROOT_CERT) as f:
1001+
with open(CAFILE_CACERT) as f:
10021002
pem = f.read()
10031003
der = ssl.PEM_cert_to_DER_cert(pem)
10041004
self.assertEqual(ctx.get_ca_certs(True), [der])
@@ -1335,15 +1335,15 @@ def test_connect_capath(self):
13351335
s.close()
13361336

13371337
def test_connect_cadata(self):
1338-
with open(CAFILE_CACERT) as f:
1338+
with open(REMOTE_ROOT_CERT) as f:
13391339
pem = f.read()
13401340
der = ssl.PEM_cert_to_DER_cert(pem)
1341-
with support.transient_internet("svn.python.org"):
1341+
with support.transient_internet(REMOTE_HOST):
13421342
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
13431343
ctx.verify_mode = ssl.CERT_REQUIRED
13441344
ctx.load_verify_locations(cadata=pem)
13451345
with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
1346-
s.connect(("svn.python.org", 443))
1346+
s.connect((REMOTE_HOST, 443))
13471347
cert = s.getpeercert()
13481348
self.assertTrue(cert)
13491349

@@ -1352,7 +1352,7 @@ def test_connect_cadata(self):
13521352
ctx.verify_mode = ssl.CERT_REQUIRED
13531353
ctx.load_verify_locations(cadata=der)
13541354
with ctx.wrap_socket(socket.socket(socket.AF_INET)) as s:
1355-
s.connect(("svn.python.org", 443))
1355+
s.connect((REMOTE_HOST, 443))
13561356
cert = s.getpeercert()
13571357
self.assertTrue(cert)
13581358

@@ -1475,13 +1475,13 @@ def test_algorithms(self):
14751475

14761476
def test_get_ca_certs_capath(self):
14771477
# capath certs are loaded on request
1478-
with support.transient_internet("svn.python.org"):
1478+
with support.transient_internet(REMOTE_HOST):
14791479
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
14801480
ctx.verify_mode = ssl.CERT_REQUIRED
14811481
ctx.load_verify_locations(capath=CAPATH)
14821482
self.assertEqual(ctx.get_ca_certs(), [])
14831483
s = ctx.wrap_socket(socket.socket(socket.AF_INET))
1484-
s.connect(("svn.python.org", 443))
1484+
s.connect((REMOTE_HOST, 443))
14851485
try:
14861486
cert = s.getpeercert()
14871487
self.assertTrue(cert)
@@ -1492,12 +1492,12 @@ def test_get_ca_certs_capath(self):
14921492
@needs_sni
14931493
def test_context_setget(self):
14941494
# Check that the context of a connected socket can be replaced.
1495-
with support.transient_internet("svn.python.org"):
1495+
with support.transient_internet(REMOTE_HOST):
14961496
ctx1 = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
14971497
ctx2 = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
14981498
s = socket.socket(socket.AF_INET)
14991499
with ctx1.wrap_socket(s) as ss:
1500-
ss.connect(("svn.python.org", 443))
1500+
ss.connect((REMOTE_HOST, 443))
15011501
self.assertIs(ss.context, ctx1)
15021502
self.assertIs(ss._sslobj.context, ctx1)
15031503
ss.context = ctx2

0 commit comments

Comments
 (0)