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

Method setUp

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

Source from the content-addressed store, hash-verified

1053 # PYTHON-5708: Encryption tests sending large payloads fail on some mongocryptd versions.
1054 @client_context.require_version_max(6, 99)
1055 def setUp(self):
1056 super().setUp()
1057 db = client_context.client.db
1058 self.coll = db.coll
1059 self.coll.drop()
1060 # Configure the encrypted 'db.coll' collection via jsonSchema.
1061 json_schema = json_data("limits", "limits-schema.json")
1062 db.create_collection(
1063 "coll",
1064 validator={"$jsonSchema": json_schema},
1065 codec_options=OPTS,
1066 write_concern=WriteConcern(w="majority"),
1067 )
1068
1069 # Create the key vault.
1070 coll = client_context.client.get_database(
1071 "keyvault", write_concern=WriteConcern(w="majority"), codec_options=OPTS
1072 )["datakeys"]
1073 coll.drop()
1074 coll.insert_one(json_data("limits", "limits-key.json"))
1075
1076 opts = AutoEncryptionOpts({"local": {"key": LOCAL_MASTER_KEY}}, "keyvault.datakeys")
1077 self.listener = OvertCommandListener()
1078 self.client_encrypted = self.rs_or_single_client(
1079 auto_encryption_opts=opts, event_listeners=[self.listener]
1080 )
1081 self.coll_encrypted = self.client_encrypted.db.coll
1082
1083 def tearDown(self) -> None:
1084 self.coll_encrypted.drop()

Callers

nothing calls this directly

Calls 10

WriteConcernClass · 0.90
AutoEncryptionOptsClass · 0.90
rs_or_single_clientMethod · 0.80
json_dataFunction · 0.70
setUpMethod · 0.45
dropMethod · 0.45
create_collectionMethod · 0.45
get_databaseMethod · 0.45
insert_oneMethod · 0.45

Tested by

no test coverage detected