style: auto-format with black + isort + ruff + prettier [skip ci-format-check]
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 5s
CI/CD Pipeline / Check push changed paths (push) Successful in 5s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 33s
CI/CD Pipeline / Build Staging API Image (push) Successful in 38s
CI/CD Pipeline / Retag skipped Staging API Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 19s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 2m18s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Failing after 2m38s
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (push) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (push) Has been skipped
CI/CD Pipeline / Integration Tests (push) Successful in 10m5s
CI/CD Pipeline / Validate - Style (push) Failing after 11m13s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 14m30s
CI/CD Pipeline / Unit Tests (push) Successful in 17m22s
CI/CD Pipeline / Validate - Security (push) Successful in 37m33s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / CI Gate (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
CI/CD Pipeline / Check if frontend-only change (push) Has been skipped
CI/CD Pipeline / PR Build API Image (push) Has been skipped
CI/CD Pipeline / PR Build Web Image (push) Has been skipped
CI/CD Pipeline / PR Build Worker Image (push) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (push) Successful in 5s
CI/CD Pipeline / Check push changed paths (push) Successful in 5s
CI/CD Pipeline / Frontend Lint (push) Has been skipped
CI/CD Pipeline / Build Staging Web Image (push) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (push) Successful in 33s
CI/CD Pipeline / Build Staging API Image (push) Successful in 38s
CI/CD Pipeline / Retag skipped Staging API Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (push) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (push) Failing after 19s
CI/CD Pipeline / Frontend Unit Tests (push) Successful in 2m18s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (push) Failing after 2m38s
CI/CD Pipeline / Staging E2E Tests (push) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (push) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (push) Has been skipped
CI/CD Pipeline / Integration Tests (push) Successful in 10m5s
CI/CD Pipeline / Validate - Style (push) Failing after 11m13s
CI/CD Pipeline / Validate - Python (mypy + alembic) (push) Successful in 14m30s
CI/CD Pipeline / Unit Tests (push) Successful in 17m22s
CI/CD Pipeline / Validate - Security (push) Successful in 37m33s
CI/CD Pipeline / Build Production API Image (push) Has been skipped
CI/CD Pipeline / Build Production Web Image (push) Has been skipped
CI/CD Pipeline / Build Production Worker Image (push) Has been skipped
CI/CD Pipeline / CI Gate (push) Has been skipped
CI/CD Pipeline / Deploy Production (push) Has been skipped
CI/CD Pipeline / Canary Release to Production (push) Has been skipped
CI/CD Pipeline / Production Browser E2E (push) Has been skipped
This commit is contained in:
@@ -103,9 +103,7 @@ def test_mediakit_asr_success(fake_user):
|
||||
|
||||
with _fake_resolver_success(desc="Feed标题"):
|
||||
with _fake_mk_available(text="这是MediaKit识别的文案", duration=12.5):
|
||||
result = scripts_ai.extract_from_douyin(
|
||||
request=body, current_user=fake_user, db=mock.MagicMock()
|
||||
)
|
||||
result = scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock())
|
||||
assert result.text == "这是MediaKit识别的文案"
|
||||
assert result.duration_seconds == 12.5
|
||||
|
||||
@@ -121,9 +119,7 @@ def test_share_text_input_extracts_url_correctly(fake_user):
|
||||
|
||||
with _fake_resolver_success():
|
||||
with _fake_mk_available(text="识别成功的文案", duration=5.0) as mk_mock:
|
||||
resp = scripts_ai.extract_from_douyin(
|
||||
request=body, current_user=fake_user, db=mock.MagicMock()
|
||||
)
|
||||
resp = scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock())
|
||||
assert resp.source_url == "https://v.douyin.com/abcdeFG/"
|
||||
assert resp.text == "识别成功的文案"
|
||||
assert resp.duration_seconds == 5.0
|
||||
@@ -163,9 +159,7 @@ def test_asr_empty_falls_back_to_desc(fake_user):
|
||||
"app.api.routes.scripts_ai._direct_url_download_and_local_asr",
|
||||
return_value=("", 0.0),
|
||||
):
|
||||
resp = scripts_ai.extract_from_douyin(
|
||||
request=body, current_user=fake_user, db=mock.MagicMock()
|
||||
)
|
||||
resp = scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock())
|
||||
assert resp.text == "Feed描述文案"
|
||||
|
||||
|
||||
@@ -186,9 +180,7 @@ def test_asr_not_configured_returns_503(fake_user):
|
||||
side_effect=HTTPException(status_code=503, detail="ASR未配置"),
|
||||
):
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
scripts_ai.extract_from_douyin(
|
||||
request=body, current_user=fake_user, db=mock.MagicMock()
|
||||
)
|
||||
scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock())
|
||||
assert exc.value.status_code == status.HTTP_503_SERVICE_UNAVAILABLE
|
||||
|
||||
|
||||
@@ -216,9 +208,7 @@ def test_asr_transcription_failure_returns_502(fake_user):
|
||||
side_effect=HTTPException(status_code=502, detail="语音识别失败"),
|
||||
):
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
scripts_ai.extract_from_douyin(
|
||||
request=body, current_user=fake_user, db=mock.MagicMock()
|
||||
)
|
||||
scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock())
|
||||
assert exc.value.status_code == status.HTTP_502_BAD_GATEWAY
|
||||
|
||||
|
||||
@@ -237,7 +227,5 @@ def test_download_timeout_returns_504(fake_user):
|
||||
side_effect=HTTPException(status_code=504, detail="视频下载超时"),
|
||||
):
|
||||
with pytest.raises(HTTPException) as exc:
|
||||
scripts_ai.extract_from_douyin(
|
||||
request=body, current_user=fake_user, db=mock.MagicMock()
|
||||
)
|
||||
scripts_ai.extract_from_douyin(request=body, current_user=fake_user, db=mock.MagicMock())
|
||||
assert exc.value.status_code == status.HTTP_504_GATEWAY_TIMEOUT
|
||||
|
||||
@@ -49,6 +49,7 @@ def _mock_resolver(
|
||||
):
|
||||
"""Mock resolve_douyin_video 返回 ResolveResult。"""
|
||||
from app.services.douyin_resolver import ResolveResult
|
||||
|
||||
return ResolveResult(video_url=video_url, desc=desc, source=source)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user