@@ -2422,6 +2422,9 @@ async def test_05_roundtrip_encrypted_unindexed(self):
2422
2422
2423
2423
# https://github.com/mongodb/specifications/blob/527e22d5090ec48bf1e144c45fc831de0f1935f6/source/client-side-encryption/tests/README.md#25-test-lookup
2424
2424
class TestLookupProse (AsyncEncryptionIntegrationTest ):
2425
+ # check libmongocrypt version?
2426
+ @async_client_context .require_no_standalone
2427
+ @async_client_context .require_version_min (7 , 0 , - 1 )
2425
2428
async def asyncSetUp (self ):
2426
2429
await super ().asyncSetUp ()
2427
2430
self .encrypted_client = await self .async_rs_or_single_client (
@@ -2432,53 +2435,54 @@ async def asyncSetUp(self):
2432
2435
)
2433
2436
await self .encrypted_client .db .drop_collection ("keyvault" )
2434
2437
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 )
2437
2441
2438
- await self .encrypted_client .db .drop ("csfle" )
2442
+ await self .encrypted_client .db .drop_collection ("csfle" )
2439
2443
await self .encrypted_client .db .create_collection (
2440
2444
"csfle" ,
2441
2445
validator = {"$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-csfle.json" )},
2442
2446
)
2443
2447
2444
- await self .encrypted_client .db .drop ("csfle2" )
2448
+ await self .encrypted_client .db .drop_collection ("csfle2" )
2445
2449
await self .encrypted_client .db .create_collection (
2446
2450
"csfle2" ,
2447
2451
validator = {"$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-csfle2.json" )},
2448
2452
)
2449
2453
2450
- await self .encrypted_client .db .drop ("qe" )
2454
+ await self .encrypted_client .db .drop_collection ("qe" )
2451
2455
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" )
2453
2457
)
2454
2458
2455
- await self .encrypted_client .db .drop ("qe2" )
2459
+ await self .encrypted_client .db .drop_collection ("qe2" )
2456
2460
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" )
2458
2462
)
2459
2463
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 " )
2462
2466
2463
- await self .encrypted_client .db .drop ("no_schema2" )
2467
+ await self .encrypted_client .db .drop_collection ("no_schema2" )
2464
2468
await self .encrypted_client .db .create_collection ("no_schema2" )
2465
2469
2466
2470
self .unencrypted_client = await self .async_rs_or_single_client ()
2467
2471
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" })
2482
2486
2483
2487
# Test requires server 8.1+ and mongocryptd/crypt_shared 8.1+.
2484
2488
@async_client_context .require_version_min (8 , 1 , - 1 )
0 commit comments