Skip to content

Commit

Permalink
fix acl_genpass with bits (#3062)
Browse files Browse the repository at this point in the history
  • Loading branch information
dvora-h committed Feb 25, 2024
1 parent ce6d7b4 commit 6116c38
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,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."
Expand Down
3 changes: 2 additions & 1 deletion tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 6116c38

Please sign in to comment.