diff --git a/redis/client.py b/redis/client.py index 96ed584cfc..cbe8a2ee33 100755 --- a/redis/client.py +++ b/redis/client.py @@ -812,6 +812,8 @@ class AbstractRedis: "HGETALL": lambda r: r and pairs_to_dict(r) or {}, "MEMORY STATS": parse_memory_stats, "MODULE LIST": lambda r: [pairs_to_dict(m) for m in r], + "STRALGO": parse_stralgo, + "ACL LIST": lambda r: list(map(str_if_bytes, r)), # **string_keys_to_dict( # "COPY " # "HEXISTS HMSET MOVE MSETNX PERSIST " @@ -833,7 +835,6 @@ class AbstractRedis: # **string_keys_to_dict("ZRANK ZREVRANK", int_or_none), # **string_keys_to_dict("BGREWRITEAOF BGSAVE", lambda r: True), # "ACL HELP": lambda r: list(map(str_if_bytes, r)), - # "ACL LIST": lambda r: list(map(str_if_bytes, r)), # "ACL LOAD": bool_ok, # "ACL SAVE": bool_ok, # "ACL USERS": lambda r: list(map(str_if_bytes, r)), @@ -855,7 +856,6 @@ class AbstractRedis: # "MODULE UNLOAD": parse_module_result, # "OBJECT": parse_object, # "QUIT": bool_ok, - # "STRALGO": parse_stralgo, # "RANDOMKEY": lambda r: r and r or None, # "SCRIPT EXISTS": lambda r: list(map(bool, r)), # "SCRIPT KILL": bool_ok, diff --git a/tests/test_asyncio/test_commands.py b/tests/test_asyncio/test_commands.py index b7d830e1f8..02bfa71e0f 100644 --- a/tests/test_asyncio/test_commands.py +++ b/tests/test_asyncio/test_commands.py @@ -74,11 +74,12 @@ class TestResponseCallbacks: """Tests for the response callback system""" async def test_response_callbacks(self, r: redis.Redis): - resp3_callbacks = redis.Redis.RESPONSE_CALLBACKS.copy() - resp3_callbacks.update(redis.Redis.RESP3_RESPONSE_CALLBACKS) - assert_resp_response( - r, r.response_callbacks, redis.Redis.RESPONSE_CALLBACKS, resp3_callbacks - ) + callbacks = redis.Redis.RESPONSE_CALLBACKS + if is_resp2_connection(r): + callbacks.update(redis.Redis.RESP2_RESPONSE_CALLBACKS) + else: + callbacks.update(redis.Redis.RESP3_RESPONSE_CALLBACKS) + assert r.response_callbacks == callbacks assert id(r.response_callbacks) != id(redis.Redis.RESPONSE_CALLBACKS) r.set_response_callback("GET", lambda x: "static") await r.set("a", "foo") diff --git a/tests/test_commands.py b/tests/test_commands.py index 0bbdcb27db..9849e7d64e 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -59,7 +59,9 @@ class TestResponseCallbacks: def test_response_callbacks(self, r): callbacks = redis.Redis.RESPONSE_CALLBACKS - if not is_resp2_connection(r): + if is_resp2_connection(r): + callbacks.update(redis.Redis.RESP2_RESPONSE_CALLBACKS) + else: callbacks.update(redis.Redis.RESP3_RESPONSE_CALLBACKS) assert r.response_callbacks == callbacks assert id(r.response_callbacks) != id(redis.Redis.RESPONSE_CALLBACKS) diff --git a/tests/test_credentials.py b/tests/test_credentials.py index 9aeb1ef1d5..9c0ff1bcea 100644 --- a/tests/test_credentials.py +++ b/tests/test_credentials.py @@ -198,6 +198,12 @@ def test_change_username_password_on_existing_connection(self, r, request): password = "origin_password" new_username = "new_username" new_password = "new_password" + + def teardown(): + r.acl_deluser(new_username) + + request.addfinalizer(teardown) + init_acl_user(r, request, username, password) r2 = _get_client( redis.Redis, request, flushdb=False, username=username, password=password