Skip to content

Commit d99b488

Browse files
authored
maint:add test for xadd bad-id #368 (#369)
fix #368
1 parent e00de41 commit d99b488

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/test_mixins/test_streams_commands.py

+10
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import pytest
66
import redis
7+
from redis import ResponseError
78

89
from fakeredis import _msgs as msgs
910
from test import testtools
@@ -823,3 +824,12 @@ def test_xreadgroup_length_less_than_count(r: redis.Redis):
823824
groupname="group1", consumername="consumer1", streams={"test-events": ">"}, count=10, block=2000
824825
)
825826
assert len(messages) == 1
827+
828+
829+
def test_xadd_change_time(r: redis.Redis):
830+
res = r.xadd("foobar", {"a": "1"})
831+
ts, seq = res.decode().split("-")
832+
new_ts = int(ts) - 10
833+
new_id = f"{new_ts}-*"
834+
with pytest.raises(ResponseError):
835+
r.xadd("foobar", {"a": "2"}, id=new_id)

0 commit comments

Comments
 (0)