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

Method test_close

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

Source from the content-addressed store, hash-verified

586 self.assertNotEqual(client_encryption.decrypt(encrypted_legacy), value)
587
588 def test_close(self):
589 client_encryption = self.create_client_encryption(
590 KMS_PROVIDERS, "keyvault.datakeys", client_context.client, OPTS
591 )
592 client_encryption.close()
593 # Close can be called multiple times.
594 client_encryption.close()
595 algo = Algorithm.AEAD_AES_256_CBC_HMAC_SHA_512_Deterministic
596 msg = "Cannot use closed ClientEncryption"
597 with self.assertRaisesRegex(InvalidOperation, msg):
598 client_encryption.create_data_key("local")
599 with self.assertRaisesRegex(InvalidOperation, msg):
600 client_encryption.encrypt("val", algo, key_alt_name="name")
601 with self.assertRaisesRegex(InvalidOperation, msg):
602 client_encryption.decrypt(Binary(b"", 6))
603
604 def test_with_statement(self):
605 with self.create_client_encryption(

Callers

nothing calls this directly

Calls 6

BinaryClass · 0.90
closeMethod · 0.45
create_data_keyMethod · 0.45
encryptMethod · 0.45
decryptMethod · 0.45

Tested by

no test coverage detected