(self)
| 1731 | self._assert_context_options(ctx) |
| 1732 | |
| 1733 | def test__create_stdlib_context(self): |
| 1734 | ctx = ssl._create_stdlib_context() |
| 1735 | self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS_CLIENT) |
| 1736 | self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) |
| 1737 | self.assertFalse(ctx.check_hostname) |
| 1738 | self._assert_context_options(ctx) |
| 1739 | |
| 1740 | if has_tls_protocol('PROTOCOL_TLSv1'): |
| 1741 | with warnings_helper.check_warnings(): |
| 1742 | ctx = ssl._create_stdlib_context(ssl.PROTOCOL_TLSv1) |
| 1743 | self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1) |
| 1744 | self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) |
| 1745 | self._assert_context_options(ctx) |
| 1746 | |
| 1747 | if has_tls_protocol('PROTOCOL_TLSv1_2'): |
| 1748 | with warnings_helper.check_warnings(): |
| 1749 | ctx = ssl._create_stdlib_context( |
| 1750 | ssl.PROTOCOL_TLSv1_2, |
| 1751 | cert_reqs=ssl.CERT_REQUIRED, |
| 1752 | check_hostname=True |
| 1753 | ) |
| 1754 | self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLSv1_2) |
| 1755 | self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) |
| 1756 | self.assertTrue(ctx.check_hostname) |
| 1757 | self._assert_context_options(ctx) |
| 1758 | |
| 1759 | ctx = ssl._create_stdlib_context(purpose=ssl.Purpose.CLIENT_AUTH) |
| 1760 | self.assertEqual(ctx.protocol, ssl.PROTOCOL_TLS_SERVER) |
| 1761 | self.assertEqual(ctx.verify_mode, ssl.CERT_NONE) |
| 1762 | self._assert_context_options(ctx) |
| 1763 | |
| 1764 | def test_check_hostname(self): |
| 1765 | with warnings_helper.check_warnings(): |
nothing calls this directly
no test coverage detected