@@ -2422,6 +2422,9 @@ async def test_05_roundtrip_encrypted_unindexed(self):
24222422
24232423# https://github.com/mongodb/specifications/blob/527e22d5090ec48bf1e144c45fc831de0f1935f6/source/client-side-encryption/tests/README.md#25-test-lookup
24242424class TestLookupProse (AsyncEncryptionIntegrationTest ):
2425+ # check libmongocrypt version?
2426+ @async_client_context .require_no_standalone
2427+ @async_client_context .require_version_min (7 , 0 , - 1 )
24252428 async def asyncSetUp (self ):
24262429 await super ().asyncSetUp ()
24272430 self .encrypted_client = await self .async_rs_or_single_client (
@@ -2432,53 +2435,54 @@ async def asyncSetUp(self):
24322435 )
24332436 await self .encrypted_client .db .drop_collection ("keyvault" )
24342437
2435- keyvault = json_data ("etc" , "data" , "lookup" , "key-doc.json" )
2436- await create_key_vault (self .encrypted_client .keyvault , keyvault )
2438+ key_doc = json_data ("etc" , "data" , "lookup" , "key-doc.json" )
2439+ key_vault = await create_key_vault (self .encrypted_client .db .keyvault , key_doc )
2440+ self .addCleanup (key_vault .drop )
24372441
2438- await self .encrypted_client .db .drop ("csfle" )
2442+ await self .encrypted_client .db .drop_collection ("csfle" )
24392443 await self .encrypted_client .db .create_collection (
24402444 "csfle" ,
24412445 validator = {"$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-csfle.json" )},
24422446 )
24432447
2444- await self .encrypted_client .db .drop ("csfle2" )
2448+ await self .encrypted_client .db .drop_collection ("csfle2" )
24452449 await self .encrypted_client .db .create_collection (
24462450 "csfle2" ,
24472451 validator = {"$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-csfle2.json" )},
24482452 )
24492453
2450- await self .encrypted_client .db .drop ("qe" )
2454+ await self .encrypted_client .db .drop_collection ("qe" )
24512455 await self .encrypted_client .db .create_collection (
2452- "qe" , validator = { "$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-qe.json" )}
2456+ "qe" , encryptedFields = json_data ("etc" , "data" , "lookup" , "schema-qe.json" )
24532457 )
24542458
2455- await self .encrypted_client .db .drop ("qe2" )
2459+ await self .encrypted_client .db .drop_collection ("qe2" )
24562460 await self .encrypted_client .db .create_collection (
2457- "qe2" , validator = { "$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-qe2.json" )}
2461+ "qe2" , encryptedFields = json_data ("etc" , "data" , "lookup" , "schema-qe2.json" )
24582462 )
24592463
2460- await self .encrypted_client .db .drop ("no_schema" )
2461- await self .encrypted_client .db .create_collection ("no-schema " )
2464+ await self .encrypted_client .db .drop_collection ("no_schema" )
2465+ await self .encrypted_client .db .create_collection ("no_schema " )
24622466
2463- await self .encrypted_client .db .drop ("no_schema2" )
2467+ await self .encrypted_client .db .drop_collection ("no_schema2" )
24642468 await self .encrypted_client .db .create_collection ("no_schema2" )
24652469
24662470 self .unencrypted_client = await self .async_rs_or_single_client ()
24672471
2468- self .encrypted_client .db .csfle .insert_one ({"csfle" : "csfle" })
2469- doc = self .unencrypted_client .db .csfle .find_one ()
2470- self .assertTrue (isinstance (doc , BSON ))
2471- self .encrypted_client .db .csfle2 .insert_one ({"csfle2" : "csfle2" })
2472- doc = self .unencrypted_client .db .csfle2 .find_one ()
2473- self .assertTrue (isinstance (doc , BSON ))
2474- self .encrypted_client .db .qe .insert_one ({"qe" : "qe" })
2475- doc = self .unencrypted_client .db .qe .find_one ()
2476- self .assertTrue (isinstance (doc , BSON ))
2477- self .encrypted_client .db .qe2 .insert_one ({"qe2" : "qe2" })
2478- doc = self .unencrypted_client .db .qe2 .find_one ()
2479- self .assertTrue (isinstance (doc , BSON ))
2480- self .encrypted_client .db .no_schema .insert_one ({"no_schema" : "no_schema" })
2481- self .encrypted_client .db .no_schema2 .insert_one ({"no_schema2" : "no_schema2" })
2472+ await self .encrypted_client .db .csfle .insert_one ({"csfle" : "csfle" })
2473+ doc = await self .unencrypted_client .db .csfle .find_one ()
2474+ self .assertTrue (isinstance (doc [ "csfle" ], Binary ))
2475+ await self .encrypted_client .db .csfle2 .insert_one ({"csfle2" : "csfle2" })
2476+ doc = await self .unencrypted_client .db .csfle2 .find_one ()
2477+ self .assertTrue (isinstance (doc [ "csfle2" ], Binary ))
2478+ await self .encrypted_client .db .qe .insert_one ({"qe" : "qe" })
2479+ doc = await self .unencrypted_client .db .qe .find_one ()
2480+ self .assertTrue (isinstance (doc [ "qe" ], Binary ))
2481+ await self .encrypted_client .db .qe2 .insert_one ({"qe2" : "qe2" })
2482+ doc = await self .unencrypted_client .db .qe2 .find_one ()
2483+ self .assertTrue (isinstance (doc [ "qe2" ], Binary ))
2484+ await self .encrypted_client .db .no_schema .insert_one ({"no_schema" : "no_schema" })
2485+ await self .encrypted_client .db .no_schema2 .insert_one ({"no_schema2" : "no_schema2" })
24822486
24832487 # Test requires server 8.1+ and mongocryptd/crypt_shared 8.1+.
24842488 @async_client_context .require_version_min (8 , 1 , - 1 )
0 commit comments