54 lines
1.6 KiB
Python
54 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""Regression: paused_* status must not show as「监听中」."""
|
|
from __future__ import annotations
|
|
|
|
from app.youtube_relay_status import summarize_relay_group
|
|
|
|
|
|
def test_summarize_paused_exclusive_not_monitoring():
|
|
row = summarize_relay_group(
|
|
group={
|
|
"id": "g1",
|
|
"enabled": True,
|
|
"has_stream_key": True,
|
|
"stream_key": "aaaa-bbbb-cccc-dddd-eeee",
|
|
"category": "normal",
|
|
"featured": [{"url": "https://live.douyin.com/1"}],
|
|
},
|
|
st={
|
|
"status": "paused_exclusive",
|
|
"error": "单路独占:当前仅允许 X 推流",
|
|
"recent_log": [],
|
|
},
|
|
session_running=False,
|
|
pipeline_enabled=True,
|
|
time_slot_mode=False,
|
|
lane_armed=True,
|
|
)
|
|
assert row["business_status"] == "paused_exclusive"
|
|
assert "独占" in (row.get("business_note") or "")
|
|
|
|
|
|
def test_summarize_paused_studio_not_monitoring():
|
|
row = summarize_relay_group(
|
|
group={
|
|
"id": "g1",
|
|
"enabled": True,
|
|
"has_stream_key": True,
|
|
"stream_key": "aaaa-bbbb-cccc-dddd-eeee",
|
|
"category": "normal",
|
|
"featured": [{"url": "https://live.douyin.com/1"}],
|
|
},
|
|
st={
|
|
"status": "paused_studio",
|
|
"error": "Studio 未 on_air 熔断中(约剩 5 分)",
|
|
"recent_log": [],
|
|
},
|
|
session_running=False,
|
|
pipeline_enabled=True,
|
|
time_slot_mode=False,
|
|
lane_armed=True,
|
|
)
|
|
assert row["business_status"] == "paused_studio"
|
|
assert "熔断" in (row.get("business_note") or "")
|