(self)
| 1541 | |
| 1542 | @unittest.skipIf(ssl is None, "requires ssl") |
| 1543 | def test_https_client(self): |
| 1544 | context = ssl.create_default_context() |
| 1545 | # allow self-signed certificates |
| 1546 | context.check_hostname = False |
| 1547 | context.verify_mode = ssl.CERT_NONE |
| 1548 | |
| 1549 | bind, port = '127.0.0.1', find_unused_port() |
| 1550 | proc = spawn_python('-u', '-m', 'http.server', str(port), '-b', bind, |
| 1551 | '--tls-cert', self.tls_cert, |
| 1552 | '--tls-key', self.tls_key, |
| 1553 | '--tls-password-file', self.tls_password_file, |
| 1554 | bufsize=1, text=True) |
| 1555 | self.addCleanup(kill_python, proc) |
| 1556 | self.addCleanup(proc.terminate) |
| 1557 | self.assertTrue(self.wait_for_server(proc, 'https', bind, port)) |
| 1558 | url = f'https://{bind}:{port}/{self.served_filename}' |
| 1559 | res = self.fetch_file(url, context=context) |
| 1560 | self.assertEqual(res, self.served_data) |
| 1561 | |
| 1562 | |
| 1563 | class TestModule(unittest.TestCase): |
nothing calls this directly
no test coverage detected