Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix acl_genpass with bits #3062

Merged
merged 1 commit into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading