diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2021-06-02 23:48:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-02 23:48:40 (GMT) |
commit | e5e93e6145090a636e67766a53b758d7ac78e3ad (patch) | |
tree | 24a6c47b566f742e192a3c43984af22b509e4e65 /Lib | |
parent | 6563ea5c60be2e4896df52eff777aa93743f1551 (diff) | |
download | cpython-e5e93e6145090a636e67766a53b758d7ac78e3ad.zip cpython-e5e93e6145090a636e67766a53b758d7ac78e3ad.tar.gz cpython-e5e93e6145090a636e67766a53b758d7ac78e3ad.tar.bz2 |
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).
(cherry picked from commit 320eaa7f42b413cd5e5436ec92d4dc5ba150395f)
Co-authored-by: Victor Stinner <vstinner@python.org>
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_ssl.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py index 00d5eff..fbd0131 100644 --- a/Lib/test/test_ssl.py +++ b/Lib/test/test_ssl.py @@ -4464,11 +4464,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: |