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

Method test_sni_callback_alert

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

Source from the content-addressed store, hash-verified

4647 self.assertEqual(calls, [])
4648
4649 def test_sni_callback_alert(self):
4650 # Returning a TLS alert is reflected to the connecting client
4651 server_context, other_context, client_context = self.sni_contexts()
4652
4653 def cb_returning_alert(ssl_sock, server_name, initial_context):
4654 return ssl.ALERT_DESCRIPTION_ACCESS_DENIED
4655 server_context.set_servername_callback(cb_returning_alert)
4656 with self.assertRaises(ssl.SSLError) as cm:
4657 stats = server_params_test(client_context, server_context,
4658 chatty=False,
4659 sni_name='supermessage')
4660 self.assertEqual(cm.exception.reason, 'TLSV1_ALERT_ACCESS_DENIED')
4661
4662 def test_sni_callback_raising(self):
4663 # Raising fails the connection with a TLS handshake failure alert.

Callers

nothing calls this directly

Calls 5

sni_contextsMethod · 0.95
server_params_testFunction · 0.85
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected