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

Method setUp

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

Source from the content-addressed store, hash-verified

686 "No environment credentials are set",
687 )
688 def setUp(self):
689 super().setUp()
690 self.listener = OvertCommandListener()
691 self.client = self.rs_or_single_client(event_listeners=[self.listener])
692 self.client.db.coll.drop()
693 self.vault = create_key_vault(self.client.keyvault.datakeys)
694
695 # Configure the encrypted field via the local schema_map option.
696 schemas = {
697 "db.coll": {
698 "bsonType": "object",
699 "properties": {
700 "encrypted_placeholder": {
701 "encrypt": {
702 "keyId": "/placeholder",
703 "bsonType": "string",
704 "algorithm": "AEAD_AES_256_CBC_HMAC_SHA_512-Random",
705 }
706 }
707 },
708 }
709 }
710 opts = AutoEncryptionOpts(
711 self.KMS_PROVIDERS,
712 "keyvault.datakeys",
713 schema_map=schemas,
714 kms_tls_options=DEFAULT_KMS_TLS,
715 )
716 self.client_encrypted = self.rs_or_single_client(
717 auto_encryption_opts=opts, uuidRepresentation="standard"
718 )
719 self.client_encryption = self.create_client_encryption(
720 self.KMS_PROVIDERS,
721 "keyvault.datakeys",
722 self.client,
723 OPTS,
724 kms_tls_options=DEFAULT_KMS_TLS,
725 )
726 self.listener.reset()
727
728 def tearDown(self) -> None:
729 self.vault.drop()

Callers

nothing calls this directly

Calls 8

AutoEncryptionOptsClass · 0.90
rs_or_single_clientMethod · 0.80
create_key_vaultFunction · 0.70
setUpMethod · 0.45
dropMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected