Spaces:
Running
Running
Adapt template tests to shared output probing
Browse files- tests/test_templates.py +13 -0
tests/test_templates.py
CHANGED
|
@@ -15,6 +15,17 @@ from app.templates.registry import TemplateRegistry
|
|
| 15 |
from app.templates.validator import TemplateValidator
|
| 16 |
from main import create_app
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
EXPECTED_CATEGORIES = {
|
| 19 |
"branding",
|
| 20 |
"conversion",
|
|
@@ -208,6 +219,7 @@ async def test_template_executor_calls_existing_operation(settings, tmp_path, mo
|
|
| 208 |
output.write_bytes(b"ID3-template-output")
|
| 209 |
|
| 210 |
monkeypatch.setattr(container.processor, "probe_inputs", fake_probe)
|
|
|
|
| 211 |
monkeypatch.setattr(container.ffmpeg, "run", fake_ffmpeg)
|
| 212 |
resolved = ResolvedRequest(
|
| 213 |
request_id="5fdbe750-4cb7-4f87-aa5c-3df50c3a6629",
|
|
@@ -254,6 +266,7 @@ def test_template_rest_endpoints_and_nested_input(settings, monkeypatch) -> None
|
|
| 254 |
output.write_bytes(b"ID3-rest-template")
|
| 255 |
|
| 256 |
monkeypatch.setattr(container.processor, "probe_inputs", fake_probe)
|
|
|
|
| 257 |
monkeypatch.setattr(container.ffmpeg, "run", fake_ffmpeg)
|
| 258 |
|
| 259 |
with TestClient(application) as client:
|
|
|
|
| 15 |
from app.templates.validator import TemplateValidator
|
| 16 |
from main import create_app
|
| 17 |
|
| 18 |
+
|
| 19 |
+
async def fake_audio_output_probe(path: Path):
|
| 20 |
+
return {
|
| 21 |
+
"duration": 1.0,
|
| 22 |
+
"container": "mp3",
|
| 23 |
+
"video_streams": [],
|
| 24 |
+
"audio_streams": [{"codec": "mp3"}],
|
| 25 |
+
"resolution": None,
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
|
| 29 |
EXPECTED_CATEGORIES = {
|
| 30 |
"branding",
|
| 31 |
"conversion",
|
|
|
|
| 219 |
output.write_bytes(b"ID3-template-output")
|
| 220 |
|
| 221 |
monkeypatch.setattr(container.processor, "probe_inputs", fake_probe)
|
| 222 |
+
monkeypatch.setattr(container.processor.ffprobe, "probe", fake_audio_output_probe)
|
| 223 |
monkeypatch.setattr(container.ffmpeg, "run", fake_ffmpeg)
|
| 224 |
resolved = ResolvedRequest(
|
| 225 |
request_id="5fdbe750-4cb7-4f87-aa5c-3df50c3a6629",
|
|
|
|
| 266 |
output.write_bytes(b"ID3-rest-template")
|
| 267 |
|
| 268 |
monkeypatch.setattr(container.processor, "probe_inputs", fake_probe)
|
| 269 |
+
monkeypatch.setattr(container.processor.ffprobe, "probe", fake_audio_output_probe)
|
| 270 |
monkeypatch.setattr(container.ffmpeg, "run", fake_ffmpeg)
|
| 271 |
|
| 272 |
with TestClient(application) as client:
|