feat(agent-office): ytpub_retry 텔레그램 콜백 → music-lab retry 프록시

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-12 00:39:31 +09:00
parent 084e4f1b4d
commit 6c178006d3
2 changed files with 59 additions and 0 deletions

View File

@@ -147,6 +147,38 @@ async def test_failed_pipeline_renotify_after_recovery():
assert sent.await_count == 2 # 재알림
@pytest.mark.asyncio
async def test_handle_ytpub_retry_calls_proxy():
from app import service_proxy
from app.telegram import webhook
retry = AsyncMock(return_value={"status_code": 202, "ok": True, "retrying_step": "video"})
fake_send = AsyncMock(return_value={"ok": True})
fake_api_call = AsyncMock(return_value={"ok": True})
with patch.object(service_proxy, "pipeline_retry", retry), \
patch("app.telegram.messaging.send_raw", fake_send), \
patch("app.telegram.webhook.api_call", fake_api_call):
res = await webhook._handle_ytpub_retry({"id": 1}, "ytpub_retry_7")
retry.assert_awaited_once_with(7)
assert res["ok"] is True
@pytest.mark.asyncio
async def test_handle_ytpub_retry_invalid_data():
from app.telegram import webhook
fake_send = AsyncMock(return_value={"ok": True})
fake_api_call = AsyncMock(return_value={"ok": True})
with patch("app.telegram.messaging.send_raw", fake_send), \
patch("app.telegram.webhook.api_call", fake_api_call):
res = await webhook._handle_ytpub_retry({"id": 1}, "ytpub_retry_abc")
assert res["ok"] is False
@pytest.mark.asyncio
async def test_failed_poll_exception_is_silent():
"""list_failed_pipelines 예외 시 poll이 조용히 넘어감 (active 알림에 영향 없음)."""