bpo-43921: Fix test_ssl.test_pha_required_nocert() (GH-26489)

Fix test_pha_required_nocert() of test_ssl: catch two more EOF cases
(when the recv() method returns an empty string).
This commit is contained in:
Victor Stinner 2021-06-02 22:25:26 +02:00 committed by GitHub
parent 8916633b76
commit 320eaa7f42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View file

@ -4460,11 +4460,18 @@ class TestPostHandshakeAuth(unittest.TestCase):
'(certificate required|EOF occurred)'
):
# receive CertificateRequest
self.assertEqual(s.recv(1024), b'OK\n')
data = s.recv(1024)
if not data:
raise ssl.SSLError(1, "EOF occurred")
self.assertEqual(data, b'OK\n')
# send empty Certificate + Finish
s.write(b'HASCERT')
# receive alert
s.recv(1024)
data = s.recv(1024)
if not data:
raise ssl.SSLError(1, "EOF occurred")
def test_pha_optional(self):
if support.verbose: