MCPcopy Index your code
hub / github.com/python/cpython / test_sni_callback

Method test_sni_callback

Lib/test/test_ssl.py:1540–1552  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1538 self.assertRaises(ValueError, ctx.set_ecdh_curve, b"foo")
1539
1540 def test_sni_callback(self):
1541 ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
1542
1543 # set_servername_callback expects a callable, or None
1544 self.assertRaises(TypeError, ctx.set_servername_callback)
1545 self.assertRaises(TypeError, ctx.set_servername_callback, 4)
1546 self.assertRaises(TypeError, ctx.set_servername_callback, "")
1547 self.assertRaises(TypeError, ctx.set_servername_callback, ctx)
1548
1549 def dummycallback(sock, servername, ctx):
1550 pass
1551 ctx.set_servername_callback(None)
1552 ctx.set_servername_callback(dummycallback)
1553
1554 def test_sni_callback_on_dead_references(self):
1555 # See https://github.com/python/cpython/issues/146080.

Callers

nothing calls this directly

Calls 2

assertRaisesMethod · 0.45

Tested by

no test coverage detected