Skip to content

Commit de13bb1

Browse files
committed
added await for host and port
1 parent 373d543 commit de13bb1

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

test/asynchronous/test_auth.py

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -338,19 +338,19 @@ def auth_string(user, password):
338338

339339
class TestSCRAMSHA1(AsyncIntegrationTest):
340340
@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(
344344
"pymongo_test", "user", "pass", roles=["userAdmin", "readWrite"]
345345
)
346346

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()
350350

351351
@async_client_context.require_no_fips
352352
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
354354

355355
client = await async_rs_or_single_client_noauth(
356356
"mongodb://user:pass@%s:%d/pymongo_test?authMechanism=SCRAM-SHA-1" % (host, port)
@@ -373,8 +373,8 @@ async def test_scram_sha1(self):
373373
class TestSCRAM(AsyncIntegrationTest):
374374
@async_client_context.require_auth
375375
@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()
378378
self._SENSITIVE_COMMANDS = monitoring._SENSITIVE_COMMANDS
379379
monitoring._SENSITIVE_COMMANDS = set()
380380
self.listener = AllowListEventListener("saslStart")
@@ -383,7 +383,7 @@ async def asyncTearDown(self):
383383
monitoring._SENSITIVE_COMMANDS = self._SENSITIVE_COMMANDS
384384
await async_client_context.client.testscram.command("dropAllUsersFromDatabase")
385385
await async_client_context.client.drop_database("testscram")
386-
super().asyncTearDown()
386+
await super().asyncTearDown()
387387

388388
async def test_scram_skip_empty_exchange(self):
389389
listener = AllowListEventListener("saslStart", "saslContinue")
@@ -491,7 +491,7 @@ async def test_scram(self):
491491
await client.testscram.command("dbstats")
492492

493493
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
495495
uri = "mongodb://both:pwd@%s:%d/testscram?replicaSet=%s" % (
496496
host,
497497
port,
@@ -505,7 +505,7 @@ async def test_scram(self):
505505
@unittest.skipUnless(HAVE_STRINGPREP, "Cannot test without stringprep")
506506
async def test_scram_saslprep(self):
507507
# 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
509509
# Test the use of SASLprep on passwords. For example,
510510
# saslprep('\u2136') becomes 'IV' and saslprep('I\u00ADX')
511511
# becomes 'IX'. SASLprep is only supported when the standard
@@ -611,19 +611,21 @@ async def test_scram_threaded(self):
611611

612612
class TestAuthURIOptions(AsyncIntegrationTest):
613613
@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+
)
618620

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()
623625

624626
async def test_uri_options(self):
625627
# 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
627629
client = await async_rs_or_single_client_noauth("mongodb://admin:pass@%s:%d" % (host, port))
628630
self.assertTrue(await client.admin.command("dbstats"))
629631

0 commit comments

Comments
 (0)