(self)
| 1957 | s.connect, self.server_addr) |
| 1958 | |
| 1959 | def test_connect_capath(self): |
| 1960 | # Verify server certificates using the `capath` argument |
| 1961 | # NOTE: the subject hashing algorithm has been changed between |
| 1962 | # OpenSSL 0.9.8n and 1.0.0, as a result the capath directory must |
| 1963 | # contain both versions of each certificate (same content, different |
| 1964 | # filename) for this test to be portable across OpenSSL releases. |
| 1965 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 1966 | ctx.load_verify_locations(capath=CAPATH) |
| 1967 | with ctx.wrap_socket(socket.socket(socket.AF_INET), |
| 1968 | server_hostname=SIGNED_CERTFILE_HOSTNAME) as s: |
| 1969 | s.connect(self.server_addr) |
| 1970 | cert = s.getpeercert() |
| 1971 | self.assertTrue(cert) |
| 1972 | |
| 1973 | # Same with a bytes `capath` argument |
| 1974 | ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT) |
| 1975 | ctx.load_verify_locations(capath=BYTES_CAPATH) |
| 1976 | with ctx.wrap_socket(socket.socket(socket.AF_INET), |
| 1977 | server_hostname=SIGNED_CERTFILE_HOSTNAME) as s: |
| 1978 | s.connect(self.server_addr) |
| 1979 | cert = s.getpeercert() |
| 1980 | self.assertTrue(cert) |
| 1981 | |
| 1982 | def test_connect_cadata(self): |
| 1983 | with open(SIGNING_CA) as f: |
nothing calls this directly
no test coverage detected