@@ -147,25 +147,17 @@ def test_init(self):
147147 def test_init_spawn_args (self ):
148148 # User can override idleShutdownTimeoutSecs
149149 opts = AutoEncryptionOpts (
150- {},
151- "keyvault.datakeys" ,
152- mongocryptd_spawn_args = ["--idleShutdownTimeoutSecs=88" ],
150+ {}, "keyvault.datakeys" , mongocryptd_spawn_args = ["--idleShutdownTimeoutSecs=88" ]
153151 )
154152 self .assertEqual (opts ._mongocryptd_spawn_args , ["--idleShutdownTimeoutSecs=88" ])
155153
156154 # idleShutdownTimeoutSecs is added by default
157- opts = AutoEncryptionOpts (
158- {},
159- "keyvault.datakeys" ,
160- mongocryptd_spawn_args = [],
161- )
155+ opts = AutoEncryptionOpts ({}, "keyvault.datakeys" , mongocryptd_spawn_args = [])
162156 self .assertEqual (opts ._mongocryptd_spawn_args , ["--idleShutdownTimeoutSecs=60" ])
163157
164158 # Also added when other options are given
165159 opts = AutoEncryptionOpts (
166- {},
167- "keyvault.datakeys" ,
168- mongocryptd_spawn_args = ["--quiet" , "--port=27020" ],
160+ {}, "keyvault.datakeys" , mongocryptd_spawn_args = ["--quiet" , "--port=27020" ]
169161 )
170162 self .assertEqual (
171163 opts ._mongocryptd_spawn_args ,
@@ -190,21 +182,15 @@ def test_init_kms_tls_options(self):
190182 opts ._parse_kms_tls_options (_IS_SYNC )
191183 with self .assertRaises (FileNotFoundError ):
192184 opts = AutoEncryptionOpts (
193- {},
194- "k.d" ,
195- kms_tls_options = {"kmip" : {"tlsCAFile" : "does-not-exist" }},
185+ {}, "k.d" , kms_tls_options = {"kmip" : {"tlsCAFile" : "does-not-exist" }}
196186 )
197187 opts ._parse_kms_tls_options (_IS_SYNC )
198188 # Success cases:
199189 tls_opts : Any
200190 for tls_opts in [None , {}]:
201191 opts = AutoEncryptionOpts ({}, "k.d" , kms_tls_options = tls_opts )
202192 self .assertEqual (opts ._kms_ssl_contexts , {})
203- opts = AutoEncryptionOpts (
204- {},
205- "k.d" ,
206- kms_tls_options = {"kmip" : {"tls" : True }, "aws" : {}},
207- )
193+ opts = AutoEncryptionOpts ({}, "k.d" , kms_tls_options = {"kmip" : {"tls" : True }, "aws" : {}})
208194 opts ._parse_kms_tls_options (_IS_SYNC )
209195 ctx = opts ._kms_ssl_contexts ["kmip" ]
210196 self .assertEqual (ctx .check_hostname , True )
@@ -382,20 +368,13 @@ async def test_auto_encrypt(self):
382368 await create_with_schema (self .db .test , json_schema )
383369 self .addAsyncCleanup (self .db .test .drop )
384370
385- opts = AutoEncryptionOpts (
386- KMS_PROVIDERS ,
387- "keyvault.datakeys" ,
388- )
371+ opts = AutoEncryptionOpts (KMS_PROVIDERS , "keyvault.datakeys" )
389372 await self ._test_auto_encrypt (opts )
390373
391374 async def test_auto_encrypt_local_schema_map (self ):
392375 # Configure the encrypted field via the local schema_map option.
393376 schemas = {"pymongo_test.test" : json_data ("custom" , "schema.json" )}
394- opts = AutoEncryptionOpts (
395- KMS_PROVIDERS ,
396- "keyvault.datakeys" ,
397- schema_map = schemas ,
398- )
377+ opts = AutoEncryptionOpts (KMS_PROVIDERS , "keyvault.datakeys" , schema_map = schemas )
399378
400379 await self ._test_auto_encrypt (opts )
401380
@@ -1190,9 +1169,7 @@ async def _test_corpus(self, opts):
11901169
11911170 async def test_corpus (self ):
11921171 opts = AutoEncryptionOpts (
1193- self .kms_providers (),
1194- "keyvault.datakeys" ,
1195- kms_tls_options = KMS_TLS_OPTS ,
1172+ self .kms_providers (), "keyvault.datakeys" , kms_tls_options = KMS_TLS_OPTS
11961173 )
11971174 await self ._test_corpus (opts )
11981175
@@ -1241,10 +1218,7 @@ async def asyncSetUp(self):
12411218 await coll .drop ()
12421219 await coll .insert_one (json_data ("limits" , "limits-key.json" ))
12431220
1244- opts = AutoEncryptionOpts (
1245- {"local" : {"key" : LOCAL_MASTER_KEY }},
1246- "keyvault.datakeys" ,
1247- )
1221+ opts = AutoEncryptionOpts ({"local" : {"key" : LOCAL_MASTER_KEY }}, "keyvault.datakeys" )
12481222 self .listener = OvertCommandListener ()
12491223 self .client_encrypted = await self .async_rs_or_single_client (
12501224 auto_encryption_opts = opts , event_listeners = [self .listener ]
@@ -1699,9 +1673,7 @@ async def test_case_1(self):
16991673 await self ._run_test (
17001674 max_pool_size = 1 ,
17011675 auto_encryption_opts = AutoEncryptionOpts (
1702- * self .optargs ,
1703- bypass_auto_encryption = False ,
1704- key_vault_client = None ,
1676+ * self .optargs , bypass_auto_encryption = False , key_vault_client = None
17051677 ),
17061678 )
17071679
@@ -1722,9 +1694,7 @@ async def test_case_2(self):
17221694 await self ._run_test (
17231695 max_pool_size = 1 ,
17241696 auto_encryption_opts = AutoEncryptionOpts (
1725- * self .optargs ,
1726- bypass_auto_encryption = False ,
1727- key_vault_client = self .client_keyvault ,
1697+ * self .optargs , bypass_auto_encryption = False , key_vault_client = self .client_keyvault
17281698 ),
17291699 )
17301700
@@ -1748,9 +1718,7 @@ async def test_case_3(self):
17481718 await self ._run_test (
17491719 max_pool_size = 1 ,
17501720 auto_encryption_opts = AutoEncryptionOpts (
1751- * self .optargs ,
1752- bypass_auto_encryption = True ,
1753- key_vault_client = None ,
1721+ * self .optargs , bypass_auto_encryption = True , key_vault_client = None
17541722 ),
17551723 )
17561724
@@ -1767,9 +1735,7 @@ async def test_case_4(self):
17671735 await self ._run_test (
17681736 max_pool_size = 1 ,
17691737 auto_encryption_opts = AutoEncryptionOpts (
1770- * self .optargs ,
1771- bypass_auto_encryption = True ,
1772- key_vault_client = self .client_keyvault ,
1738+ * self .optargs , bypass_auto_encryption = True , key_vault_client = self .client_keyvault
17731739 ),
17741740 )
17751741
@@ -1789,9 +1755,7 @@ async def test_case_5(self):
17891755 await self ._run_test (
17901756 max_pool_size = None ,
17911757 auto_encryption_opts = AutoEncryptionOpts (
1792- * self .optargs ,
1793- bypass_auto_encryption = False ,
1794- key_vault_client = None ,
1758+ * self .optargs , bypass_auto_encryption = False , key_vault_client = None
17951759 ),
17961760 )
17971761
@@ -1814,9 +1778,7 @@ async def test_case_6(self):
18141778 await self ._run_test (
18151779 max_pool_size = None ,
18161780 auto_encryption_opts = AutoEncryptionOpts (
1817- * self .optargs ,
1818- bypass_auto_encryption = False ,
1819- key_vault_client = self .client_keyvault ,
1781+ * self .optargs , bypass_auto_encryption = False , key_vault_client = self .client_keyvault
18201782 ),
18211783 )
18221784
@@ -1840,9 +1802,7 @@ async def test_case_7(self):
18401802 await self ._run_test (
18411803 max_pool_size = None ,
18421804 auto_encryption_opts = AutoEncryptionOpts (
1843- * self .optargs ,
1844- bypass_auto_encryption = True ,
1845- key_vault_client = None ,
1805+ * self .optargs , bypass_auto_encryption = True , key_vault_client = None
18461806 ),
18471807 )
18481808
@@ -1859,9 +1819,7 @@ async def test_case_8(self):
18591819 await self ._run_test (
18601820 max_pool_size = None ,
18611821 auto_encryption_opts = AutoEncryptionOpts (
1862- * self .optargs ,
1863- bypass_auto_encryption = True ,
1864- key_vault_client = self .client_keyvault ,
1822+ * self .optargs , bypass_auto_encryption = True , key_vault_client = self .client_keyvault
18651823 ),
18661824 )
18671825
@@ -1899,8 +1857,7 @@ async def asyncSetUp(self):
18991857 )
19001858 self .malformed_cipher_text = Binary (self .malformed_cipher_text , 6 )
19011859 opts = AutoEncryptionOpts (
1902- key_vault_namespace = "keyvault.datakeys" ,
1903- kms_providers = kms_providers_map ,
1860+ key_vault_namespace = "keyvault.datakeys" , kms_providers = kms_providers_map
19041861 )
19051862 self .listener = AllowListEventListener ("aggregate" )
19061863 self .encrypted_client = await self .async_rs_or_single_client (
@@ -2372,9 +2329,7 @@ async def asyncSetUp(self):
23722329 {"local" : {"key" : LOCAL_MASTER_KEY }}, key_vault .full_name , self .key_vault_client , OPTS
23732330 )
23742331 opts = AutoEncryptionOpts (
2375- {"local" : {"key" : LOCAL_MASTER_KEY }},
2376- key_vault .full_name ,
2377- bypass_query_analysis = True ,
2332+ {"local" : {"key" : LOCAL_MASTER_KEY }}, key_vault .full_name , bypass_query_analysis = True
23782333 )
23792334 self .encrypted_client = await self .async_rs_or_single_client (auto_encryption_opts = opts )
23802335
@@ -2941,9 +2896,7 @@ async def AsyncMongoClient(**kwargs):
29412896
29422897 # Create an Queryable Encryption collection.
29432898 opts = AutoEncryptionOpts (
2944- kms_providers_map ,
2945- "keyvault.datakeys" ,
2946- encrypted_fields_map = encrypted_fields_map ,
2899+ kms_providers_map , "keyvault.datakeys" , encrypted_fields_map = encrypted_fields_map
29472900 )
29482901 encrypted_client = await AsyncMongoClient (auto_encryption_opts = opts )
29492902
@@ -2995,9 +2948,7 @@ async def asyncSetUp(self):
29952948 {"local" : {"key" : LOCAL_MASTER_KEY }}, key_vault .full_name , self .key_vault_client , OPTS
29962949 )
29972950 opts = AutoEncryptionOpts (
2998- {"local" : {"key" : LOCAL_MASTER_KEY }},
2999- key_vault .full_name ,
3000- bypass_query_analysis = True ,
2951+ {"local" : {"key" : LOCAL_MASTER_KEY }}, key_vault .full_name , bypass_query_analysis = True
30012952 )
30022953 self .encrypted_client = await self .async_rs_or_single_client (auto_encryption_opts = opts )
30032954 self .db = self .encrypted_client .db
0 commit comments