trading/tests/services/kevin_signal_bridge/test_cursor.py
Viktor Barzin cff2564428
Some checks failed
ci/woodpecker/push/woodpecker Pipeline was canceled
feat(kevin_bridge): exit-scan daily job + cursor + audit writer
2026-05-24 01:03:53 +00:00

27 lines
680 B
Python

"""Tests for the Redis cursor."""
import fakeredis.aioredis
from services.kevin_signal_bridge.cursor import RedisCursor
async def _redis():
return fakeredis.aioredis.FakeRedis()
async def test_cursor_defaults_to_zero():
cursor = RedisCursor(await _redis())
assert await cursor.last_seen_id() == 0
async def test_cursor_advance_persists_value():
cursor = RedisCursor(await _redis())
await cursor.advance(42)
assert await cursor.last_seen_id() == 42
async def test_cursor_advance_never_goes_backwards():
cursor = RedisCursor(await _redis())
await cursor.advance(42)
await cursor.advance(10)
assert await cursor.last_seen_id() == 42