43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Preparing stream must never count as on-air / ready for FFmpeg."""
|
|
from __future__ import annotations
|
|
|
|
from app import youtube_neko as yn
|
|
|
|
|
|
def test_payload_stream_confirmed_rejects_preparing():
|
|
assert not yn._payload_stream_confirmed(
|
|
{
|
|
"live_status": "preparing",
|
|
"health": "excellent",
|
|
"text": "Preparing stream Excellent connection",
|
|
"signals": {"preparing_stream": True},
|
|
}
|
|
)
|
|
assert not yn._payload_stream_confirmed(
|
|
{
|
|
"live_status": "live",
|
|
"health": "excellent",
|
|
"text": "Preparing stream Excellent connection Stream is healthy",
|
|
}
|
|
)
|
|
|
|
|
|
def test_payload_nodata_or_pending_includes_preparing():
|
|
assert yn._payload_nodata_or_pending(
|
|
{
|
|
"live_status": "preparing",
|
|
"text": "Preparing stream",
|
|
"signals": {"preparing_stream": True},
|
|
}
|
|
)
|
|
|
|
|
|
def test_ffmpeg_pid_alive_helper():
|
|
from app.youtube_relay_pipeline import _ffmpeg_pid_alive
|
|
import os
|
|
|
|
assert _ffmpeg_pid_alive(0) is False
|
|
assert _ffmpeg_pid_alive(-1) is False
|
|
assert _ffmpeg_pid_alive(os.getpid()) is True
|