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

Method test_bad_server_hostname

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

Source from the content-addressed store, hash-verified

1931
1932
1933 def test_bad_server_hostname(self):
1934 ctx = ssl.create_default_context()
1935 with self.assertRaises(ValueError):
1936 ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(),
1937 server_hostname="")
1938 with self.assertRaises(ValueError):
1939 ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(),
1940 server_hostname=".example.org")
1941 with self.assertRaises(TypeError):
1942 ctx.wrap_bio(ssl.MemoryBIO(), ssl.MemoryBIO(),
1943 server_hostname="example.org\x00evil.com")
1944
1945
1946class MemoryBIOTests(unittest.TestCase):

Callers

nothing calls this directly

Calls 2

wrap_bioMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected