diff options
| author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2017-12-20 18:24:43 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-12-20 18:24:43 (GMT) |
| commit | 51eb1c6b9c0b382dfd6e0428eacff0c7891a6fc3 (patch) | |
| tree | c9043b4a9f959fe562a695ec35cb0718101110e9 /Lib/test/test_asyncio/test_sslproto.py | |
| parent | a7a751dd7b08a5bb6cb399c1b2a6ca7b24aba51d (diff) | |
| download | cpython-51eb1c6b9c0b382dfd6e0428eacff0c7891a6fc3.zip cpython-51eb1c6b9c0b382dfd6e0428eacff0c7891a6fc3.tar.gz cpython-51eb1c6b9c0b382dfd6e0428eacff0c7891a6fc3.tar.bz2 | |
bpo-29970: Make ssh_handshake_timeout None by default (#4939)
* Make ssh_handshake_timeout None by default.
* Raise ValueError if ssl_handshake_timeout is used without ssl.
* Raise ValueError if ssl_handshake_timeout is not positive.
Diffstat (limited to 'Lib/test/test_asyncio/test_sslproto.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_sslproto.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index 1c42a35..a7498e8 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -75,6 +75,22 @@ class SslProtoHandshakeTests(test_utils.TestCase): self.loop.run_until_complete(tasks.sleep(0.2, loop=self.loop)) self.assertTrue(transport.abort.called) + def test_handshake_timeout_zero(self): + sslcontext = test_utils.dummy_ssl_context() + app_proto = mock.Mock() + waiter = mock.Mock() + with self.assertRaisesRegex(ValueError, 'a positive number'): + sslproto.SSLProtocol(self.loop, app_proto, sslcontext, waiter, + ssl_handshake_timeout=0) + + def test_handshake_timeout_negative(self): + sslcontext = test_utils.dummy_ssl_context() + app_proto = mock.Mock() + waiter = mock.Mock() + with self.assertRaisesRegex(ValueError, 'a positive number'): + sslproto.SSLProtocol(self.loop, app_proto, sslcontext, waiter, + ssl_handshake_timeout=-10) + def test_eof_received_waiter(self): waiter = asyncio.Future(loop=self.loop) ssl_proto = self.ssl_protocol(waiter) |
