Basic test of an SSL client connecting to a server
(self)
| 2820 | |
| 2821 | @support.requires_resource('walltime') |
| 2822 | def test_echo(self): |
| 2823 | """Basic test of an SSL client connecting to a server""" |
| 2824 | if support.verbose: |
| 2825 | sys.stdout.write("\n") |
| 2826 | |
| 2827 | client_context, server_context, hostname = testing_context() |
| 2828 | |
| 2829 | with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_SERVER): |
| 2830 | server_params_test(client_context=client_context, |
| 2831 | server_context=server_context, |
| 2832 | chatty=True, connectionchatty=True, |
| 2833 | sni_name=hostname) |
| 2834 | |
| 2835 | client_context.check_hostname = False |
| 2836 | with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_CLIENT): |
| 2837 | with self.assertRaises(ssl.SSLError) as e: |
| 2838 | server_params_test(client_context=server_context, |
| 2839 | server_context=client_context, |
| 2840 | chatty=True, connectionchatty=True, |
| 2841 | sni_name=hostname) |
| 2842 | self.assertIn( |
| 2843 | 'Cannot create a client socket with a PROTOCOL_TLS_SERVER context', |
| 2844 | str(e.exception) |
| 2845 | ) |
| 2846 | |
| 2847 | with self.subTest(client=ssl.PROTOCOL_TLS_SERVER, server=ssl.PROTOCOL_TLS_SERVER): |
| 2848 | with self.assertRaises(ssl.SSLError) as e: |
| 2849 | server_params_test(client_context=server_context, |
| 2850 | server_context=server_context, |
| 2851 | chatty=True, connectionchatty=True) |
| 2852 | self.assertIn( |
| 2853 | 'Cannot create a client socket with a PROTOCOL_TLS_SERVER context', |
| 2854 | str(e.exception) |
| 2855 | ) |
| 2856 | |
| 2857 | with self.subTest(client=ssl.PROTOCOL_TLS_CLIENT, server=ssl.PROTOCOL_TLS_CLIENT): |
| 2858 | with self.assertRaises(ssl.SSLError) as e: |
| 2859 | server_params_test(client_context=server_context, |
| 2860 | server_context=client_context, |
| 2861 | chatty=True, connectionchatty=True) |
| 2862 | self.assertIn( |
| 2863 | 'Cannot create a client socket with a PROTOCOL_TLS_SERVER context', |
| 2864 | str(e.exception)) |
| 2865 | |
| 2866 | @unittest.skip("TODO: RUSTPYTHON; flaky") |
| 2867 | @unittest.skipUnless(support.Py_GIL_DISABLED, "test is only useful if the GIL is disabled") |
nothing calls this directly
no test coverage detected