diff options
| author | Andy McCurdy <andy@andymccurdy.com> | 2019-09-30 12:38:53 -0700 |
|---|---|---|
| committer | Andy McCurdy <andy@andymccurdy.com> | 2019-12-28 22:23:43 -0800 |
| commit | 7ff9a0bc3a2ca68601fe0b8bf5bed9840393bc01 (patch) | |
| tree | 357f4be0b52abbb5b89c70ee808c46f7150f6ead | |
| parent | 5bb06d9b798b8d3a7f81233eaa64d78223f42222 (diff) | |
| download | redis-py-7ff9a0bc3a2ca68601fe0b8bf5bed9840393bc01.tar.gz | |
Implement ACL GENPASS
| -rwxr-xr-x | redis/client.py | 5 | ||||
| -rw-r--r-- | tests/test_commands.py | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/redis/client.py b/redis/client.py index 69d9d05..9591eeb 100755 --- a/redis/client.py +++ b/redis/client.py @@ -526,6 +526,7 @@ class Redis(object): string_keys_to_dict('XREAD XREADGROUP', parse_xread), string_keys_to_dict('BGREWRITEAOF BGSAVE', lambda r: True), { + 'ACL GENPASS': nativestr, 'ACL WHOAMI': nativestr, 'CLIENT GETNAME': lambda r: r and nativestr(r), 'CLIENT ID': int, @@ -875,6 +876,10 @@ class Redis(object): "Get the username for the current connection" return self.execute_command('ACL WHOAMI') + def acl_genpass(self): + "Generate a random password value" + return self.execute_command('ACL GENPASS') + def bgrewriteaof(self): "Tell the Redis server to rewrite the AOF file from data in memory." return self.execute_command('BGREWRITEAOF') diff --git a/tests/test_commands.py b/tests/test_commands.py index 9ad1fd0..14a2b56 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -67,6 +67,11 @@ class TestRedisCommands(object): # SERVER INFORMATION @skip_if_server_version_lt('6.0.0') + def test_acl_genpass(self, r): + password = r.acl_genpass() + assert isinstance(password, basestring) + + @skip_if_server_version_lt('6.0.0') def test_acl_whoami(self, r): username = r.acl_whoami() assert isinstance(username, basestring) |
