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 authored and vladvildanov committed Sep 27, 2024
1 parent f752591 commit 2f2bc5d
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 @@ -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."
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 2f2bc5d

Please sign in to comment.