MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / test_tlsCRLFile_support

Method test_tlsCRLFile_support

test/test_ssl.py:379–423  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

377 @client_context.require_no_api_version
378 @ignore_deprecations
379 def test_tlsCRLFile_support(self):
380 if not hasattr(ssl, "VERIFY_CRL_CHECK_LEAF") or HAVE_PYSSL:
381 self.assertRaises(
382 ConfigurationError,
383 self.simple_client,
384 "localhost",
385 ssl=True,
386 tlsCAFile=CA_PEM,
387 tlsCRLFile=CRL_PEM,
388 serverSelectionTimeoutMS=1000,
389 )
390 else:
391 connected(
392 self.simple_client(
393 "localhost",
394 ssl=True,
395 tlsCAFile=CA_PEM,
396 serverSelectionTimeoutMS=1000,
397 **self.credentials, # type: ignore[arg-type]
398 )
399 )
400
401 with self.assertRaises(ConnectionFailure):
402 connected(
403 self.simple_client(
404 "localhost",
405 ssl=True,
406 tlsCAFile=CA_PEM,
407 tlsCRLFile=CRL_PEM,
408 serverSelectionTimeoutMS=1000,
409 **self.credentials, # type: ignore[arg-type]
410 )
411 )
412
413 uri_fmt = "mongodb://localhost/?ssl=true&tlsCAFile=%s&serverSelectionTimeoutMS=1000"
414 connected(self.simple_client(uri_fmt % (CA_PEM,), **self.credentials)) # type: ignore
415
416 uri_fmt = (
417 "mongodb://localhost/?ssl=true&tlsCRLFile=%s"
418 "&tlsCAFile=%s&serverSelectionTimeoutMS=1000"
419 )
420 with self.assertRaises(ConnectionFailure):
421 connected(
422 self.simple_client(uri_fmt % (CRL_PEM, CA_PEM), **self.credentials) # type: ignore[arg-type]
423 )
424
425 @unittest.skipIf(
426 "PyPy" in sys.version and not _IS_SYNC,

Callers

nothing calls this directly

Calls 2

connectedFunction · 0.90
simple_clientMethod · 0.45

Tested by

no test coverage detected