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

Method test_bson_errors

test/test_encryption.py:530–542  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

528 client_encryption.encrypt("str", algo, key_id=Binary(b"123"))
529
530 def test_bson_errors(self):
531 client_encryption = self.create_client_encryption(
532 KMS_PROVIDERS, "keyvault.datakeys", client_context.client, OPTS
533 )
534
535 # Attempt to encrypt an unencodable object.
536 unencodable_value = object()
537 with self.assertRaises(BSONError):
538 client_encryption.encrypt(
539 unencodable_value,
540 Algorithm.AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic,
541 key_id=Binary.from_uuid(uuid.uuid4()),
542 )
543
544 def test_codec_options(self):
545 with self.assertRaisesRegex(TypeError, "codec_options must be"):

Callers

nothing calls this directly

Calls 3

from_uuidMethod · 0.80
encryptMethod · 0.45

Tested by

no test coverage detected