(self)
| 1014 | |
| 1015 | @skipUnless(False, "FIXME: bpo-32706") |
| 1016 | def test_check_hostname(self): |
| 1017 | self.client.quit() |
| 1018 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 1019 | self.assertEqual(ctx.verify_mode, ssl.CERT_REQUIRED) |
| 1020 | self.assertEqual(ctx.check_hostname, True) |
| 1021 | ctx.load_verify_locations(CAFILE) |
| 1022 | self.client = ftplib.FTP_TLS(context=ctx, timeout=TIMEOUT) |
| 1023 | |
| 1024 | # 127.0.0.1 doesn't match SAN |
| 1025 | self.client.connect(self.server.host, self.server.port) |
| 1026 | with self.assertRaises(ssl.CertificateError): |
| 1027 | self.client.auth() |
| 1028 | # exception quits connection |
| 1029 | |
| 1030 | self.client.connect(self.server.host, self.server.port) |
| 1031 | self.client.prot_p() |
| 1032 | with self.assertRaises(ssl.CertificateError): |
| 1033 | with self.client.transfercmd("list") as sock: |
| 1034 | pass |
| 1035 | self.client.quit() |
| 1036 | |
| 1037 | self.client.connect("localhost", self.server.port) |
| 1038 | self.client.auth() |
| 1039 | self.client.quit() |
| 1040 | |
| 1041 | self.client.connect("localhost", self.server.port) |
| 1042 | self.client.prot_p() |
| 1043 | with self.client.transfercmd("list") as sock: |
| 1044 | pass |
| 1045 | |
| 1046 | |
| 1047 | class TestTimeouts(TestCase): |
nothing calls this directly
no test coverage detected