Skip to content

Commit

Permalink
Fix python tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
nihohit committed Dec 20, 2023
1 parent c71ff91 commit d4d9d01
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions python/python/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,25 +156,25 @@ async def test_can_connect_with_auth_requirepass(
is_cluster = isinstance(redis_client, RedisClusterClient)
password = "TEST_AUTH"
credentials = RedisCredentials(password)
# TODO: We create a new client only with the primary node (in CMD, in CME a single address is enough to
# init the client with all topology), as the ACL command in CMD is routed only to the primary ATM.
# Remove it when https://github.com/aws/babushka/issues/633 is closed.
primary_address = redis_client.config.addresses[0]
try:
await redis_client.custom_command(
["CONFIG", "SET", "requirepass", password]
)

with pytest.raises(ClosingError) as e:
# Creation of a new client without password should fail
await create_client(request, is_cluster, addresses=[primary_address])
await create_client(
request,
is_cluster,
addresses=redis_client.config.addresses,
)
assert "NOAUTH" in str(e)

auth_client = await create_client(
request,
is_cluster,
credentials,
addresses=[primary_address],
addresses=redis_client.config.addresses,
)
key = get_random_string(10)
assert await auth_client.set(key, key) == OK
Expand All @@ -185,7 +185,7 @@ async def test_can_connect_with_auth_requirepass(
request,
is_cluster,
credentials,
addresses=[primary_address],
addresses=redis_client.config.addresses,
)
await auth_client.custom_command(["CONFIG", "SET", "requirepass", ""])

Expand Down Expand Up @@ -219,15 +219,11 @@ async def test_can_connect_with_auth_acl(
assert await redis_client.set(key, key) == OK
credentials = RedisCredentials(password, username)

# TODO: We create a new client only with the primary node (in CMD, in CME a single address is enough to
# init the client with all topology), as the ACL command in CMD is routed only to the primary ATM.
# Remove it when https://github.com/aws/babushka/issues/633 is closed.
primary_address = redis_client.config.addresses[0]
testuser_client = await create_client(
request,
is_cluster,
credentials,
addresses=[primary_address],
addresses=redis_client.config.addresses,
)
assert await testuser_client.get(key) == key
with pytest.raises(RequestError) as e:
Expand Down

0 comments on commit d4d9d01

Please sign in to comment.