Files
crypto_monitor_user/tests/test_instance_live_push_lib.py
dekun 53863559f4 Initialize crypto_monitor_user (user edition) from monitor codebase.
Retarget git remote, install path, and deploy docs from crypto_monitor to crypto_monitor_user.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-17 16:18:13 +08:00

21 lines
546 B
Python

"""instance_live_push_lib 单元测试."""
from __future__ import annotations
import json
from lib.instance.instance_live_push_lib import InstanceLivePush
def test_tick_increments_version_and_connect_event() -> None:
push = InstanceLivePush()
v1 = push.tick("test")
v2 = push.tick("test")
assert v1 == 1
assert v2 == 2
gen = push.iter_sse()
first = next(gen)
assert first.startswith("event: live")
data = json.loads(first.split("data: ", 1)[1].strip())
assert data["live_version"] == 2
push.stop()