@@ -2426,73 +2426,62 @@ class TestLookupProse(AsyncEncryptionIntegrationTest):
2426
2426
@async_client_context .require_version_min (7 , 0 , - 1 )
2427
2427
async def asyncSetUp (self ):
2428
2428
await super ().asyncSetUp ()
2429
- self . encrypted_client = await self .async_rs_or_single_client (
2429
+ encrypted_client = await self .async_rs_or_single_client (
2430
2430
auto_encryption_opts = AutoEncryptionOpts (
2431
2431
key_vault_namespace = "db.keyvault" ,
2432
2432
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2433
2433
)
2434
2434
)
2435
- await self . encrypted_client .db . drop_collection ( "keyvault " )
2435
+ await encrypted_client .drop_database ( "db " )
2436
2436
2437
2437
key_doc = json_data ("etc" , "data" , "lookup" , "key-doc.json" )
2438
- key_vault = await create_key_vault (self . encrypted_client .db .keyvault , key_doc )
2438
+ key_vault = await create_key_vault (encrypted_client .db .keyvault , key_doc )
2439
2439
self .addCleanup (key_vault .drop )
2440
2440
2441
- await self .encrypted_client .db .drop_collection ("csfle" )
2442
- await self .encrypted_client .db .create_collection (
2441
+ await encrypted_client .db .create_collection (
2443
2442
"csfle" ,
2444
2443
validator = {"$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-csfle.json" )},
2445
2444
)
2446
-
2447
- await self .encrypted_client .db .drop_collection ("csfle2" )
2448
- await self .encrypted_client .db .create_collection (
2445
+ await encrypted_client .db .create_collection (
2449
2446
"csfle2" ,
2450
2447
validator = {"$jsonSchema" : json_data ("etc" , "data" , "lookup" , "schema-csfle2.json" )},
2451
2448
)
2452
-
2453
- await self .encrypted_client .db .drop_collection ("qe" )
2454
- await self .encrypted_client .db .create_collection (
2449
+ await encrypted_client .db .create_collection (
2455
2450
"qe" , encryptedFields = json_data ("etc" , "data" , "lookup" , "schema-qe.json" )
2456
2451
)
2457
-
2458
- await self .encrypted_client .db .drop_collection ("qe2" )
2459
- await self .encrypted_client .db .create_collection (
2452
+ await encrypted_client .db .create_collection (
2460
2453
"qe2" , encryptedFields = json_data ("etc" , "data" , "lookup" , "schema-qe2.json" )
2461
2454
)
2455
+ await encrypted_client .db .create_collection ("no_schema" )
2456
+ await encrypted_client .db .create_collection ("no_schema2" )
2462
2457
2463
- await self .encrypted_client .db .drop_collection ("no_schema" )
2464
- await self .encrypted_client .db .create_collection ("no_schema" )
2458
+ unencrypted_client = await self .async_rs_or_single_client ()
2465
2459
2466
- await self .encrypted_client .db .drop_collection ("no_schema2" )
2467
- await self .encrypted_client .db .create_collection ("no_schema2" )
2468
-
2469
- self .unencrypted_client = await self .async_rs_or_single_client ()
2470
-
2471
- await self .encrypted_client .db .csfle .insert_one ({"csfle" : "csfle" })
2472
- doc = await self .unencrypted_client .db .csfle .find_one ()
2460
+ await encrypted_client .db .csfle .insert_one ({"csfle" : "csfle" })
2461
+ doc = await unencrypted_client .db .csfle .find_one ()
2473
2462
self .assertTrue (isinstance (doc ["csfle" ], Binary ))
2474
- await self . encrypted_client .db .csfle2 .insert_one ({"csfle2" : "csfle2" })
2475
- doc = await self . unencrypted_client .db .csfle2 .find_one ()
2463
+ await encrypted_client .db .csfle2 .insert_one ({"csfle2" : "csfle2" })
2464
+ doc = await unencrypted_client .db .csfle2 .find_one ()
2476
2465
self .assertTrue (isinstance (doc ["csfle2" ], Binary ))
2477
- await self . encrypted_client .db .qe .insert_one ({"qe" : "qe" })
2478
- doc = await self . unencrypted_client .db .qe .find_one ()
2466
+ await encrypted_client .db .qe .insert_one ({"qe" : "qe" })
2467
+ doc = await unencrypted_client .db .qe .find_one ()
2479
2468
self .assertTrue (isinstance (doc ["qe" ], Binary ))
2480
- await self . encrypted_client .db .qe2 .insert_one ({"qe2" : "qe2" })
2481
- doc = await self . unencrypted_client .db .qe2 .find_one ()
2469
+ await encrypted_client .db .qe2 .insert_one ({"qe2" : "qe2" })
2470
+ doc = await unencrypted_client .db .qe2 .find_one ()
2482
2471
self .assertTrue (isinstance (doc ["qe2" ], Binary ))
2483
- await self . encrypted_client .db .no_schema .insert_one ({"no_schema" : "no_schema" })
2484
- await self . encrypted_client .db .no_schema2 .insert_one ({"no_schema2" : "no_schema2" })
2472
+ await encrypted_client .db .no_schema .insert_one ({"no_schema" : "no_schema" })
2473
+ await encrypted_client .db .no_schema2 .insert_one ({"no_schema2" : "no_schema2" })
2485
2474
2486
2475
@async_client_context .require_version_min (8 , 1 , - 1 )
2487
- async def test_1 (self ):
2488
- self . encrypted_client = await self .async_rs_or_single_client (
2476
+ async def test_1_csfle_joins_no_schema (self ):
2477
+ encrypted_client = await self .async_rs_or_single_client (
2489
2478
auto_encryption_opts = AutoEncryptionOpts (
2490
2479
key_vault_namespace = "db.keyvault" ,
2491
2480
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2492
2481
)
2493
2482
)
2494
2483
doc = await anext (
2495
- await self . encrypted_client .db .csfle .aggregate (
2484
+ await encrypted_client .db .csfle .aggregate (
2496
2485
[
2497
2486
{"$match" : {"csfle" : "csfle" }},
2498
2487
{
@@ -2512,15 +2501,15 @@ async def test_1(self):
2512
2501
self .assertEqual (doc , {"csfle" : "csfle" , "matched" : [{"no_schema" : "no_schema" }]})
2513
2502
2514
2503
@async_client_context .require_version_min (8 , 1 , - 1 )
2515
- async def test_2 (self ):
2516
- self . encrypted_client = await self .async_rs_or_single_client (
2504
+ async def test_2_qe_joins_no_schema (self ):
2505
+ encrypted_client = await self .async_rs_or_single_client (
2517
2506
auto_encryption_opts = AutoEncryptionOpts (
2518
2507
key_vault_namespace = "db.keyvault" ,
2519
2508
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2520
2509
)
2521
2510
)
2522
2511
doc = await anext (
2523
- await self . encrypted_client .db .qe .aggregate (
2512
+ await encrypted_client .db .qe .aggregate (
2524
2513
[
2525
2514
{"$match" : {"qe" : "qe" }},
2526
2515
{
@@ -2540,15 +2529,15 @@ async def test_2(self):
2540
2529
self .assertEqual (doc , {"qe" : "qe" , "matched" : [{"no_schema" : "no_schema" }]})
2541
2530
2542
2531
@async_client_context .require_version_min (8 , 1 , - 1 )
2543
- async def test_3 (self ):
2544
- self . encrypted_client = await self .async_rs_or_single_client (
2532
+ async def test_3_no_schema_joins_csfle (self ):
2533
+ encrypted_client = await self .async_rs_or_single_client (
2545
2534
auto_encryption_opts = AutoEncryptionOpts (
2546
2535
key_vault_namespace = "db.keyvault" ,
2547
2536
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2548
2537
)
2549
2538
)
2550
2539
doc = await anext (
2551
- await self . encrypted_client .db .no_schema .aggregate (
2540
+ await encrypted_client .db .no_schema .aggregate (
2552
2541
[
2553
2542
{"$match" : {"no_schema" : "no_schema" }},
2554
2543
{
@@ -2565,15 +2554,15 @@ async def test_3(self):
2565
2554
self .assertEqual (doc , {"no_schema" : "no_schema" , "matched" : [{"csfle" : "csfle" }]})
2566
2555
2567
2556
@async_client_context .require_version_min (8 , 1 , - 1 )
2568
- async def test_4 (self ):
2569
- self . encrypted_client = await self .async_rs_or_single_client (
2557
+ async def test_4_no_schema_joins_qe (self ):
2558
+ encrypted_client = await self .async_rs_or_single_client (
2570
2559
auto_encryption_opts = AutoEncryptionOpts (
2571
2560
key_vault_namespace = "db.keyvault" ,
2572
2561
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2573
2562
)
2574
2563
)
2575
2564
doc = await anext (
2576
- await self . encrypted_client .db .no_schema .aggregate (
2565
+ await encrypted_client .db .no_schema .aggregate (
2577
2566
[
2578
2567
{"$match" : {"no_schema" : "no_schema" }},
2579
2568
{
@@ -2593,15 +2582,15 @@ async def test_4(self):
2593
2582
self .assertEqual (doc , {"no_schema" : "no_schema" , "matched" : [{"qe" : "qe" }]})
2594
2583
2595
2584
@async_client_context .require_version_min (8 , 1 , - 1 )
2596
- async def test_5 (self ):
2597
- self . encrypted_client = await self .async_rs_or_single_client (
2585
+ async def test_5_csfle_joins_csfle2 (self ):
2586
+ encrypted_client = await self .async_rs_or_single_client (
2598
2587
auto_encryption_opts = AutoEncryptionOpts (
2599
2588
key_vault_namespace = "db.keyvault" ,
2600
2589
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2601
2590
)
2602
2591
)
2603
2592
doc = await anext (
2604
- await self . encrypted_client .db .csfle .aggregate (
2593
+ await encrypted_client .db .csfle .aggregate (
2605
2594
[
2606
2595
{"$match" : {"csfle" : "csfle" }},
2607
2596
{
@@ -2621,15 +2610,15 @@ async def test_5(self):
2621
2610
self .assertEqual (doc , {"csfle" : "csfle" , "matched" : [{"csfle2" : "csfle2" }]})
2622
2611
2623
2612
@async_client_context .require_version_min (8 , 1 , - 1 )
2624
- async def test_6 (self ):
2625
- self . encrypted_client = await self .async_rs_or_single_client (
2613
+ async def test_6_qe_joins_qe2 (self ):
2614
+ encrypted_client = await self .async_rs_or_single_client (
2626
2615
auto_encryption_opts = AutoEncryptionOpts (
2627
2616
key_vault_namespace = "db.keyvault" ,
2628
2617
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2629
2618
)
2630
2619
)
2631
2620
doc = await anext (
2632
- await self . encrypted_client .db .qe .aggregate (
2621
+ await encrypted_client .db .qe .aggregate (
2633
2622
[
2634
2623
{"$match" : {"qe" : "qe" }},
2635
2624
{
@@ -2649,15 +2638,15 @@ async def test_6(self):
2649
2638
self .assertEqual (doc , {"qe" : "qe" , "matched" : [{"qe2" : "qe2" }]})
2650
2639
2651
2640
@async_client_context .require_version_min (8 , 1 , - 1 )
2652
- async def test_7 (self ):
2653
- self . encrypted_client = await self .async_rs_or_single_client (
2641
+ async def test_7_no_schema_joins_no_schema2 (self ):
2642
+ encrypted_client = await self .async_rs_or_single_client (
2654
2643
auto_encryption_opts = AutoEncryptionOpts (
2655
2644
key_vault_namespace = "db.keyvault" ,
2656
2645
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2657
2646
)
2658
2647
)
2659
2648
doc = await anext (
2660
- await self . encrypted_client .db .no_schema .aggregate (
2649
+ await encrypted_client .db .no_schema .aggregate (
2661
2650
[
2662
2651
{"$match" : {"no_schema" : "no_schema" }},
2663
2652
{
@@ -2677,16 +2666,16 @@ async def test_7(self):
2677
2666
self .assertEqual (doc , {"no_schema" : "no_schema" , "matched" : [{"no_schema2" : "no_schema2" }]})
2678
2667
2679
2668
@async_client_context .require_version_min (8 , 1 , - 1 )
2680
- async def test_8 (self ):
2681
- self . encrypted_client = await self .async_rs_or_single_client (
2669
+ async def test_8_csfle_joins_qe (self ):
2670
+ encrypted_client = await self .async_rs_or_single_client (
2682
2671
auto_encryption_opts = AutoEncryptionOpts (
2683
2672
key_vault_namespace = "db.keyvault" ,
2684
2673
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2685
2674
)
2686
2675
)
2687
2676
with self .assertRaises (PyMongoError ) as exc :
2688
2677
_ = await anext (
2689
- await self . encrypted_client .db .csfle .aggregate (
2678
+ await encrypted_client .db .csfle .aggregate (
2690
2679
[
2691
2680
{"$match" : {"csfle" : "qe" }},
2692
2681
{
@@ -2703,16 +2692,16 @@ async def test_8(self):
2703
2692
self .assertTrue ("not supported" in str (exc ))
2704
2693
2705
2694
@async_client_context .require_version_max (8 , 1 , - 1 )
2706
- async def test_9 (self ):
2707
- self . encrypted_client = await self .async_rs_or_single_client (
2695
+ async def test_9_error (self ):
2696
+ encrypted_client = await self .async_rs_or_single_client (
2708
2697
auto_encryption_opts = AutoEncryptionOpts (
2709
2698
key_vault_namespace = "db.keyvault" ,
2710
2699
kms_providers = {"local" : {"key" : LOCAL_MASTER_KEY }},
2711
2700
)
2712
2701
)
2713
2702
with self .assertRaises (PyMongoError ) as exc :
2714
2703
_ = await anext (
2715
- await self . encrypted_client .db .csfle .aggregate (
2704
+ await encrypted_client .db .csfle .aggregate (
2716
2705
[
2717
2706
{"$match" : {"csfle" : "csfle" }},
2718
2707
{
0 commit comments