MCPcopy
hub / github.com/urllib3/urllib3 / test_ca_dir_verified

Method test_ca_dir_verified

test/with_dummyserver/test_https.py:280–300  ·  view source on GitHub ↗
(self, tmp_path: Path)

Source from the content-addressed store, hash-verified

278 assert not warn.called, warn.call_args_list
279
280 def test_ca_dir_verified(self, tmp_path: Path) -> None:
281 # OpenSSL looks up certificates by the hash for their name, see c_rehash
282 # TODO infer the bytes using `cryptography.x509.Name.public_bytes`.
283 # https://github.com/pyca/cryptography/pull/3236
284 shutil.copyfile(DEFAULT_CA, str(tmp_path / "81deb5f7.0"))
285
286 with HTTPSConnectionPool(
287 self.host,
288 self.port,
289 cert_reqs="CERT_REQUIRED",
290 ca_cert_dir=str(tmp_path),
291 ssl_minimum_version=self.tls_version(),
292 ) as https_pool:
293 with contextlib.closing(https_pool._new_conn()) as conn:
294 assert conn.__class__ == VerifiedHTTPSConnection
295
296 with warnings.catch_warnings(record=True) as w:
297 r = https_pool.request("GET", "/")
298 assert r.status == 200
299
300 assert [str(wm) for wm in w] == []
301
302 def test_invalid_common_name(self) -> None:
303 with HTTPSConnectionPool(

Callers

nothing calls this directly

Calls 4

tls_versionMethod · 0.95
HTTPSConnectionPoolClass · 0.90
_new_connMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected