From fb1f92842ff5aa91ffcd04fe8f80e96e07b52fad Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Mon, 1 Jan 2024 13:22:15 +0200 Subject: [PATCH] fix acl_genpass with bits (#3062) --- redis/commands/core.py | 1 + tests/test_commands.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/redis/commands/core.py b/redis/commands/core.py index f97724d030..8fbd0d9104 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -97,6 +97,7 @@ def acl_genpass(self, bits: Union[int, None] = None, **kwargs) -> ResponseT: b = int(bits) if b < 0 or b > 4096: raise ValueError + pieces.append(b) except ValueError: raise DataError( "genpass optionally accepts a bits argument, between 0 and 4096." diff --git a/tests/test_commands.py b/tests/test_commands.py index 6660c2c6b0..b2d7c1b9ed 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -201,8 +201,9 @@ def test_acl_genpass(self, r): r.acl_genpass(-5) r.acl_genpass(5555) - r.acl_genpass(555) + password = r.acl_genpass(555) assert isinstance(password, (str, bytes)) + assert len(password) == 139 @skip_if_server_version_lt("7.0.0") @skip_if_redis_enterprise()