mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
bpo-37120: Add SSLContext.num_tickets (GH-13719)
Signed-off-by: Christian Heimes <christian@python.org>
This commit is contained in:
parent
47eb223406
commit
78c7d52779
4 changed files with 69 additions and 0 deletions
|
@ -1634,6 +1634,24 @@ class ContextTests(unittest.TestCase):
|
|||
obj = ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO())
|
||||
self.assertIsInstance(obj, MySSLObject)
|
||||
|
||||
@unittest.skipUnless(IS_OPENSSL_1_1_1, "Test requires OpenSSL 1.1.1")
|
||||
def test_num_tickest(self):
|
||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
||||
self.assertEqual(ctx.num_tickets, 2)
|
||||
ctx.num_tickets = 1
|
||||
self.assertEqual(ctx.num_tickets, 1)
|
||||
ctx.num_tickets = 0
|
||||
self.assertEqual(ctx.num_tickets, 0)
|
||||
with self.assertRaises(ValueError):
|
||||
ctx.num_tickets = -1
|
||||
with self.assertRaises(TypeError):
|
||||
ctx.num_tickets = None
|
||||
|
||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||
self.assertEqual(ctx.num_tickets, 2)
|
||||
with self.assertRaises(ValueError):
|
||||
ctx.num_tickets = 1
|
||||
|
||||
|
||||
class SSLErrorTests(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue