From e85fe3b8e39de4d568a11f146162a4f7d944130c Mon Sep 17 00:00:00 2001 From: dvora-h <67596500+dvora-h@users.noreply.github.com> Date: Mon, 27 Jun 2022 15:05:05 +0300 Subject: Fix `XAUTOCLAIM` to return the full response (#2252) * fix parse_xautoclaim * linters --- redis/client.py | 3 ++- tests/test_commands.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/redis/client.py b/redis/client.py index 86061d5..c63fb13 100755 --- a/redis/client.py +++ b/redis/client.py @@ -310,7 +310,8 @@ def parse_xclaim(response, **options): def parse_xautoclaim(response, **options): if options.get("parse_justid", False): return response[1] - return parse_stream_list(response[1]) + response[1] = parse_stream_list(response[1]) + return response def parse_xinfo_stream(response, **options): diff --git a/tests/test_commands.py b/tests/test_commands.py index fcd2ed1..715d18c 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -3781,14 +3781,14 @@ class TestRedisCommands: # trying to claim a message that isn't already pending doesn't # do anything response = r.xautoclaim(stream, group, consumer2, min_idle_time=0) - assert response == [] + assert response == [b"0-0", []] # read the group as consumer1 to initially claim the messages r.xreadgroup(group, consumer1, streams={stream: ">"}) # claim one message as consumer2 response = r.xautoclaim(stream, group, consumer2, min_idle_time=0, count=1) - assert response == [message] + assert response[1] == [message] # reclaim the messages as consumer1, but use the justid argument # which only returns message ids -- cgit v1.2.1