summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoey Prat <roey.prat@redislabs.com>2018-10-28 12:07:33 +0200
committerRoey Prat <roey.prat@redislabs.com>2018-10-28 14:26:43 +0200
commit4ef348569a985c6e030a0995a0c78ed7e18fe264 (patch)
tree9fa08d65ae4323ed031f095a04d7b8d9da5278a3
parent3ba1d14bc74f9a5045d714ce67422ef05b59b724 (diff)
downloadredis-py-4ef348569a985c6e030a0995a0c78ed7e18fe264.tar.gz
unit test for xclaim
-rw-r--r--tests/test_commands.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_commands.py b/tests/test_commands.py
index 929b4bd..d5fae9e 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -1783,6 +1783,21 @@ class TestStrictCommands(object):
assert sr.xtrim(stream_name, 234) == 0
assert sr.xtrim(stream_name, 234, approximate=False) == 66
+ @skip_if_server_version_lt('5.0.0')
+ def test_strict_xclaim(self, sr):
+ stream_name = 'xclaim_test_stream'
+ group_name = 'xclaim_test_consumer_group'
+ sr.delete(stream_name)
+
+ stamp = sr.xadd(stream_name, {"john": "wick"})
+ sr.xgroup_create(stream_name, group_name, id='0')
+ sr.xreadgroup(group_name, 'action_movie_consumer',
+ xclaim_test_stream=0)
+ assert sr.xinfo_consumers(stream_name, group_name)[0][
+ b('name')] == b('action_movie_consumer')
+ assert sr.xclaim(stream_name, group_name, 'reeves_fan',
+ min_idle_time=0, message_ids=(stamp,))[0][0] == stamp
+
def test_strict_zadd(self, sr):
sr.zadd('a', 1.0, 'a1', 2.0, 'a2', a3=3.0)
assert sr.zrange('a', 0, -1, withscores=True) == \