@@ -338,19 +338,19 @@ def auth_string(user, password):
338
338
339
339
class TestSCRAMSHA1 (AsyncIntegrationTest ):
340
340
@async_client_context .require_auth
341
- def asyncSetUp (self ):
342
- super ().asyncSetUp ()
343
- async_client_context .create_user (
341
+ async def asyncSetUp (self ):
342
+ await super ().asyncSetUp ()
343
+ await async_client_context .create_user (
344
344
"pymongo_test" , "user" , "pass" , roles = ["userAdmin" , "readWrite" ]
345
345
)
346
346
347
- def asyncTearDown (self ):
348
- async_client_context .drop_user ("pymongo_test" , "user" )
349
- super ().asyncTearDown ()
347
+ async def asyncTearDown (self ):
348
+ await async_client_context .drop_user ("pymongo_test" , "user" )
349
+ await super ().asyncTearDown ()
350
350
351
351
@async_client_context .require_no_fips
352
352
async def test_scram_sha1 (self ):
353
- host , port = async_client_context .host , async_client_context .port
353
+ host , port = await async_client_context .host , await async_client_context .port
354
354
355
355
client = await async_rs_or_single_client_noauth (
356
356
"mongodb://user:pass@%s:%d/pymongo_test?authMechanism=SCRAM-SHA-1" % (host , port )
@@ -373,8 +373,8 @@ async def test_scram_sha1(self):
373
373
class TestSCRAM (AsyncIntegrationTest ):
374
374
@async_client_context .require_auth
375
375
@async_client_context .require_version_min (3 , 7 , 2 )
376
- def asyncSetUp (self ):
377
- super ().asyncSetUp ()
376
+ async def asyncSetUp (self ):
377
+ await super ().asyncSetUp ()
378
378
self ._SENSITIVE_COMMANDS = monitoring ._SENSITIVE_COMMANDS
379
379
monitoring ._SENSITIVE_COMMANDS = set ()
380
380
self .listener = AllowListEventListener ("saslStart" )
@@ -383,7 +383,7 @@ async def asyncTearDown(self):
383
383
monitoring ._SENSITIVE_COMMANDS = self ._SENSITIVE_COMMANDS
384
384
await async_client_context .client .testscram .command ("dropAllUsersFromDatabase" )
385
385
await async_client_context .client .drop_database ("testscram" )
386
- super ().asyncTearDown ()
386
+ await super ().asyncTearDown ()
387
387
388
388
async def test_scram_skip_empty_exchange (self ):
389
389
listener = AllowListEventListener ("saslStart" , "saslContinue" )
@@ -491,7 +491,7 @@ async def test_scram(self):
491
491
await client .testscram .command ("dbstats" )
492
492
493
493
if async_client_context .is_rs :
494
- host , port = async_client_context .host , async_client_context .port
494
+ host , port = await async_client_context .host , await async_client_context .port
495
495
uri = "mongodb://both:pwd@%s:%d/testscram?replicaSet=%s" % (
496
496
host ,
497
497
port ,
@@ -505,7 +505,7 @@ async def test_scram(self):
505
505
@unittest .skipUnless (HAVE_STRINGPREP , "Cannot test without stringprep" )
506
506
async def test_scram_saslprep (self ):
507
507
# Step 4: test SASLprep
508
- host , port = async_client_context .host , async_client_context .port
508
+ host , port = await async_client_context .host , await async_client_context .port
509
509
# Test the use of SASLprep on passwords. For example,
510
510
# saslprep('\u2136') becomes 'IV' and saslprep('I\u00ADX')
511
511
# becomes 'IX'. SASLprep is only supported when the standard
@@ -611,19 +611,21 @@ async def test_scram_threaded(self):
611
611
612
612
class TestAuthURIOptions (AsyncIntegrationTest ):
613
613
@async_client_context .require_auth
614
- def asyncSetUp (self ):
615
- super ().asyncSetUp ()
616
- async_client_context .create_user ("admin" , "admin" , "pass" )
617
- async_client_context .create_user ("pymongo_test" , "user" , "pass" , ["userAdmin" , "readWrite" ])
614
+ async def asyncSetUp (self ):
615
+ await super ().asyncSetUp ()
616
+ await async_client_context .create_user ("admin" , "admin" , "pass" )
617
+ await async_client_context .create_user (
618
+ "pymongo_test" , "user" , "pass" , ["userAdmin" , "readWrite" ]
619
+ )
618
620
619
- def asyncTearDown (self ):
620
- async_client_context .drop_user ("pymongo_test" , "user" )
621
- async_client_context .drop_user ("admin" , "admin" )
622
- super ().asyncTearDown ()
621
+ async def asyncTearDown (self ):
622
+ await async_client_context .drop_user ("pymongo_test" , "user" )
623
+ await async_client_context .drop_user ("admin" , "admin" )
624
+ await super ().asyncTearDown ()
623
625
624
626
async def test_uri_options (self ):
625
627
# Test default to admin
626
- host , port = async_client_context .host , async_client_context .port
628
+ host , port = await async_client_context .host , await async_client_context .port
627
629
client = await async_rs_or_single_client_noauth ("mongodb://admin:pass@%s:%d" % (host , port ))
628
630
self .assertTrue (await client .admin .command ("dbstats" ))
629
631
0 commit comments