"""RTSP URL 日志脱敏。""" from __future__ import annotations from app.services.video.stream_worker import redact_rtsp_url def test_redact_rtsp_url_with_credentials() -> None: assert ( redact_rtsp_url("rtsp://admin:secret@10.0.0.1:554/Streaming/Channels/101") == "rtsp://***@10.0.0.1:554/Streaming/Channels/101" ) def test_redact_rtsp_url_without_credentials_unchanged() -> None: url = "rtsp://10.0.0.1:554/Streaming/Channels/101" assert redact_rtsp_url(url) == url def test_redact_rtsp_url_empty() -> None: assert redact_rtsp_url(None) == "" assert redact_rtsp_url("") == ""