Skip to content

bpo-43921: Cleanup test_ssl.test_wrong_cert_tls13() #26520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions Lib/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3192,23 +3192,16 @@ def test_wrong_cert_tls13(self):
client_context.wrap_socket(socket.socket(),
server_hostname=hostname,
suppress_ragged_eofs=False) as s:
# TLS 1.3 perform client cert exchange after handshake
s.connect((HOST, server.port))
try:
with self.assertRaisesRegex(
ssl.SSLError,
'alert unknown ca|EOF occurred'
):
# TLS 1.3 perform client cert exchange after handshake
s.write(b'data')
s.read(1000)
s.write(b'should have failed already')
s.read(1000)
except ssl.SSLError as e:
if support.verbose:
sys.stdout.write("\nSSLError is %r\n" % e)
except OSError as e:
if e.errno != errno.ECONNRESET:
raise
if support.verbose:
sys.stdout.write("\nsocket.error is %r\n" % e)
else:
self.fail("Use of invalid cert should have failed!")

def test_rude_shutdown(self):
"""A brutal shutdown of an SSL server should raise an OSError
Expand Down