419 lines
17 KiB
Python
419 lines
17 KiB
Python
|
|
import pytest
|
||
|
|
from app.domain.tasks import GPU_TYPES
|
||
|
|
from app.services.jobs import input_ids
|
||
|
|
from app.services.orchestration.resource_policy import resource_plan
|
||
|
|
from app.adapters.provider.contracts import validate_arguments
|
||
|
|
from app.domain.errors import MediaError
|
||
|
|
|
||
|
|
TASKS = (
|
||
|
|
"audio.dialogue.speech",
|
||
|
|
"video.dialogue.analyze",
|
||
|
|
"video.lipsync",
|
||
|
|
"video.dialogue.inspect",
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def test_registered_resources_and_asset_ownership():
|
||
|
|
for task in TASKS:
|
||
|
|
assert task in GPU_TYPES
|
||
|
|
assert resource_plan(task) == [("execute", "new_gpu")]
|
||
|
|
assert resource_plan("video.dialogue.select") == [("select", "cpu_media")]
|
||
|
|
assert resource_plan("text.dialogue.plan") == [("script", "qwen_http")]
|
||
|
|
assert set(
|
||
|
|
input_ids(
|
||
|
|
{"reference_asset_id": "r", "base_video_asset_id": "v", "face_tracks_asset_id": "t"}, {}
|
||
|
|
)
|
||
|
|
) == {"r", "v", "t"}
|
||
|
|
|
||
|
|
|
||
|
|
def test_speech_contract_rejects_private_paths_and_unknown_controls():
|
||
|
|
inputs = {"prompt": "hello", "reference_asset_id": "a" * 32}
|
||
|
|
params = {"profile": "voxcpm2-v1", "voice": "A", "style": "calm", "speed": 1, "seed": 10}
|
||
|
|
validate_arguments(TASKS[0], inputs, params)
|
||
|
|
for key, value in (("reference_asset_id", "/workspace/file"), ("speaker_path", "https://host")):
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments(TASKS[0], {**inputs, key: value}, params)
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments(TASKS[0], inputs, {**params, "speed": True})
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.parametrize("speech, lipsync", [(True, False), (False, True)])
|
||
|
|
def test_capabilities_reflect_independent_local_enablement(tmp_path, speech, lipsync):
|
||
|
|
from app.core.config import Settings
|
||
|
|
from app.adapters.provider.contracts import capabilities
|
||
|
|
|
||
|
|
settings = Settings(
|
||
|
|
mode="test",
|
||
|
|
database_url="sqlite+aiosqlite:///:memory:",
|
||
|
|
workspace_root=tmp_path,
|
||
|
|
inference_base_url="http://example.test",
|
||
|
|
dialogue_speech_enabled=speech,
|
||
|
|
dialogue_lipsync_enabled=lipsync,
|
||
|
|
)
|
||
|
|
items = {row["task_type"]: row["available"] for row in capabilities(settings)}
|
||
|
|
for task in (*TASKS, "audio.dialogue.inspect"):
|
||
|
|
assert items[task] is (speech if task.startswith("audio.") else lipsync)
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.parametrize("task", ["video.lipsync", "video.dialogue.inspect"])
|
||
|
|
def test_old_visual_certificate_cannot_admit_a_neutral_rest_job(task):
|
||
|
|
from app.adapters.provider.dialogue_gpu import (
|
||
|
|
ADAPTER_CONTRACT_VERSION,
|
||
|
|
AUDIO_CONTEXT_SHIFT_POLICY,
|
||
|
|
MOUTH_BLEND_POLICY,
|
||
|
|
REVISIONS,
|
||
|
|
SILENCE_POLICY,
|
||
|
|
certified,
|
||
|
|
profile,
|
||
|
|
)
|
||
|
|
|
||
|
|
evidence = {
|
||
|
|
"task_type": task,
|
||
|
|
"profile": profile(task),
|
||
|
|
"available": True,
|
||
|
|
"decision": "pass",
|
||
|
|
"adapter_contract_version": ADAPTER_CONTRACT_VERSION,
|
||
|
|
"revision": REVISIONS[task],
|
||
|
|
"max_people": 1,
|
||
|
|
"report_sha256": "a" * 64,
|
||
|
|
}
|
||
|
|
assert not certified(task, evidence, SILENCE_POLICY)
|
||
|
|
rest_only = {**evidence, "speech_silence_policy": SILENCE_POLICY}
|
||
|
|
assert not certified(task, rest_only, SILENCE_POLICY)
|
||
|
|
visual = {**rest_only, "mouth_blend_policy": MOUTH_BLEND_POLICY}
|
||
|
|
assert certified(task, visual, SILENCE_POLICY) is (task != "video.lipsync")
|
||
|
|
assert certified(task, {**visual, "audio_context_shift_policy": AUDIO_CONTEXT_SHIFT_POLICY}, SILENCE_POLICY)
|
||
|
|
|
||
|
|
|
||
|
|
def test_certificate_requires_model_and_measurement():
|
||
|
|
from app.adapters.provider.dialogue_gpu import certified
|
||
|
|
|
||
|
|
assert not certified("video.lipsync", {"available": True, "profile": "musetalk-v15-v1"})
|
||
|
|
assert not certified("video.lipsync", {})
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.asyncio
|
||
|
|
@pytest.mark.parametrize(
|
||
|
|
"count,local_limit,remote_limit", [(1, 1, 1), (2, 1, 2), (2, 2, 1), (2, 2, 2)]
|
||
|
|
)
|
||
|
|
async def test_prepare_checks_all_visible_faces(
|
||
|
|
tmp_path, monkeypatch, count, local_limit, remote_limit
|
||
|
|
):
|
||
|
|
import json
|
||
|
|
from types import SimpleNamespace
|
||
|
|
from unittest.mock import AsyncMock
|
||
|
|
from app.adapters.provider import dialogue_gpu as gpu
|
||
|
|
|
||
|
|
path = tmp_path / "tracks.json"
|
||
|
|
path.write_text(
|
||
|
|
json.dumps({"decision": "pass", "tracks": [{"speaker_id": str(i)} for i in range(count)]})
|
||
|
|
)
|
||
|
|
settings = SimpleNamespace(
|
||
|
|
dialogue_lipsync_enabled=True,
|
||
|
|
dialogue_two_faces_enabled=local_limit == 2,
|
||
|
|
inference_remote_files=False,
|
||
|
|
)
|
||
|
|
provider = SimpleNamespace(
|
||
|
|
settings=settings,
|
||
|
|
_asset=lambda aid, assets: assets[aid],
|
||
|
|
upstream_capabilities=AsyncMock(
|
||
|
|
return_value={"dialogue": {"lipsync": {"max_people": remote_limit}}}
|
||
|
|
),
|
||
|
|
)
|
||
|
|
monkeypatch.setattr(gpu, "certified", lambda *args: True)
|
||
|
|
inputs = {
|
||
|
|
"face_tracks_asset_id": "t",
|
||
|
|
"speech_tracks": [{"speaker_id": "a", "target_track_id": "a", "audio_asset_id": "a"}],
|
||
|
|
}
|
||
|
|
if count > min(local_limit, remote_limit):
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
await gpu.prepare(provider, "video.lipsync", inputs, {}, {"t": path, "a": path})
|
||
|
|
else:
|
||
|
|
assert (await gpu.prepare(provider, "video.lipsync", inputs, {}, {"t": path, "a": path}))[
|
||
|
|
"input"
|
||
|
|
]["speech_tracks"]
|
||
|
|
|
||
|
|
|
||
|
|
def test_two_speakers_require_separate_aligned_stems():
|
||
|
|
a, b = "a" * 32, "b" * 32
|
||
|
|
stems = [{"speaker_id": s, "target_track_id": s, "audio_asset_id": s} for s in (a, b)]
|
||
|
|
inp = {"video_asset_id": a, "face_tracks_asset_id": b, "speech_tracks": stems}
|
||
|
|
p = {"profile": "musetalk-v15-v1", "fps": 24, "num_frames": 48, "seed": 7}
|
||
|
|
validate_arguments("video.lipsync", inp, p)
|
||
|
|
assert set(input_ids(inp, p)) == {a, b}
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments("video.lipsync", {**inp, "audio_asset_id": a}, p)
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments("video.lipsync", {**inp, "speech_tracks": [stems[0], stems[0]]}, p)
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.asyncio
|
||
|
|
async def test_submission_checks_owner_of_voice_reference():
|
||
|
|
from types import SimpleNamespace
|
||
|
|
from unittest.mock import AsyncMock
|
||
|
|
from app.services import jobs
|
||
|
|
from app.core.errors import fail
|
||
|
|
from fastapi import HTTPException
|
||
|
|
|
||
|
|
body = SimpleNamespace(
|
||
|
|
task_type="audio.dialogue.speech",
|
||
|
|
input={"prompt": "你好", "reference_asset_id": "a" * 32},
|
||
|
|
parameters={"profile": "voxcpm2-v1", "voice": "role", "seed": 42},
|
||
|
|
count=1,
|
||
|
|
)
|
||
|
|
with pytest.MonkeyPatch.context() as monkey:
|
||
|
|
|
||
|
|
async def check(session, asset_id, owner):
|
||
|
|
assert asset_id == "a" * 32 and owner == "owner"
|
||
|
|
fail(404, "asset_not_found", "不可用素材")
|
||
|
|
|
||
|
|
lookup = AsyncMock(side_effect=check)
|
||
|
|
monkey.setattr(jobs, "owned_asset", lookup)
|
||
|
|
with pytest.raises(HTTPException):
|
||
|
|
await jobs.validate_submission(None, body, "owner", SimpleNamespace())
|
||
|
|
assert lookup.await_count == 1
|
||
|
|
|
||
|
|
|
||
|
|
def test_operator_sample_exact_request_only(tmp_path):
|
||
|
|
import hashlib, json, time
|
||
|
|
from types import SimpleNamespace
|
||
|
|
from app.adapters.provider.dialogue_gpu import approved_sample
|
||
|
|
|
||
|
|
p = {"profile": "voxcpm2-v1", "voice": "A", "seed": 2}
|
||
|
|
inputs = {"prompt": "test"}
|
||
|
|
settings = SimpleNamespace(state_root=tmp_path)
|
||
|
|
context = {"owner_id": "a" * 32, "job_id": "b" * 32}
|
||
|
|
assert not approved_sample(settings, TASKS[0], inputs, p, context)
|
||
|
|
key = hashlib.sha256(
|
||
|
|
json.dumps(
|
||
|
|
[TASKS[0], inputs, p], sort_keys=True, separators=(",", ":"), ensure_ascii=False
|
||
|
|
).encode()
|
||
|
|
).hexdigest()
|
||
|
|
folder = tmp_path / "dialogue-calibration"
|
||
|
|
folder.mkdir()
|
||
|
|
(folder / (key + ".json")).write_text(
|
||
|
|
json.dumps({"sha256": key, "owner_id": context["owner_id"], "expires_at": time.time() + 60})
|
||
|
|
)
|
||
|
|
assert not approved_sample(settings, TASKS[0], inputs, p, {**context, "owner_id": "c" * 32})
|
||
|
|
assert approved_sample(settings, TASKS[0], inputs, p, context)
|
||
|
|
assert approved_sample(settings, TASKS[0], inputs, p, context)
|
||
|
|
assert not approved_sample(settings, TASKS[0], inputs, p, {**context, "job_id": "d" * 32})
|
||
|
|
assert not approved_sample(settings, TASKS[0], inputs, {**p, "seed": 3}, context)
|
||
|
|
|
||
|
|
|
||
|
|
def test_audio_inspection_has_strict_text_voice_and_resource_contract():
|
||
|
|
aid, ref, speaker = "a" * 32, "b" * 32, "c" * 32
|
||
|
|
inp = {
|
||
|
|
"audio_asset_id": aid,
|
||
|
|
"reference_asset_id": ref,
|
||
|
|
"expected_text": "听到了。",
|
||
|
|
"speaker_id": speaker,
|
||
|
|
}
|
||
|
|
p = {"profile": "dialogue-audio-v1", "sample_rate": 48000}
|
||
|
|
assert resource_plan("audio.dialogue.inspect") == [("execute", "new_gpu")]
|
||
|
|
validate_arguments("audio.dialogue.inspect", inp, p)
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments("audio.dialogue.inspect", {**inp, "reference_asset_id": aid}, p)
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments("audio.dialogue.inspect", inp, {**p, "allow_missing_identity": True})
|
||
|
|
assert resource_plan("audio.dialogue.extract") == [("extract", "cpu_media")]
|
||
|
|
|
||
|
|
def test_public_lip_shift_is_bounded_and_inspection_remains_blind():
|
||
|
|
inputs={"video_asset_id":"a"*32,"face_tracks_asset_id":"b"*32,
|
||
|
|
"audio_asset_id":"c"*32}
|
||
|
|
p={"profile":"musetalk-v15-v1","fps":24,"num_frames":48,"speaker_id":"d"*32,"target_track_id":"d"*32}
|
||
|
|
for shift in [-6,0,6]:
|
||
|
|
validate_arguments("video.lipsync",inputs,{**p,"audio_context_shift_frames":shift})
|
||
|
|
for shift in [-7,7,True,1.0]:
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments("video.lipsync",inputs,{**p,"audio_context_shift_frames":shift})
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments("video.dialogue.inspect",{**inputs,"base_video_asset_id":"e"*32},
|
||
|
|
{**p,"audio_context_shift_frames":3})
|
||
|
|
|
||
|
|
|
||
|
|
@pytest.mark.parametrize("task", ["video.lipsync", "video.dialogue.inspect"])
|
||
|
|
@pytest.mark.parametrize("nested", [False, True])
|
||
|
|
@pytest.mark.parametrize(
|
||
|
|
("requested", "evidence_policy", "allowed"),
|
||
|
|
[
|
||
|
|
(None, "neutral-rest-v1", True),
|
||
|
|
("neutral-rest-v1", "source-rest-v2", False),
|
||
|
|
("source-rest-v2", "neutral-rest-v1", False),
|
||
|
|
("source-rest-v2", "source-rest-v2", True),
|
||
|
|
],
|
||
|
|
)
|
||
|
|
async def test_silence_policy_is_explicit_and_certificate_must_match(
|
||
|
|
tmp_path, task, requested, evidence_policy, allowed, nested
|
||
|
|
):
|
||
|
|
import json
|
||
|
|
from types import SimpleNamespace
|
||
|
|
from app.adapters.provider import dialogue_gpu as gpu
|
||
|
|
|
||
|
|
a, b, c, d = (str(i) * 32 for i in range(1, 5))
|
||
|
|
inputs = {
|
||
|
|
"video_asset_id": a,
|
||
|
|
"face_tracks_asset_id": b,
|
||
|
|
"speech_tracks": [{"speaker_id": d, "target_track_id": d, "audio_asset_id": c}],
|
||
|
|
}
|
||
|
|
if task == gpu.INSPECT:
|
||
|
|
inputs["base_video_asset_id"] = d
|
||
|
|
p = {"profile": "musetalk-v15-v1", "fps": 24, "num_frames": 48}
|
||
|
|
if requested is not None:
|
||
|
|
p["speech_silence_policy"] = requested
|
||
|
|
validate_arguments(task, inputs, p)
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments(task, inputs, {**p, "speech_silence_policy": "unrecognized"})
|
||
|
|
|
||
|
|
tracks = tmp_path / "tracks.json"
|
||
|
|
tracks.write_text(json.dumps({"decision": "pass", "tracks": [{"speaker_id": d}]}))
|
||
|
|
|
||
|
|
async def capabilities():
|
||
|
|
evidence = dict(
|
||
|
|
available=True, profile=gpu.profile(task), decision="pass", task_type=task,
|
||
|
|
adapter_contract_version="dialogue-v1", speech_silence_policy=evidence_policy,
|
||
|
|
audio_context_shift_policy="bounded-feature-shift-v1",
|
||
|
|
mouth_blend_policy="semantic-skin-ellipse-v1", max_people=1,
|
||
|
|
revision=gpu.REVISIONS[task], report_sha256="b" * 64,
|
||
|
|
)
|
||
|
|
key = gpu.KEYS[task]
|
||
|
|
if nested:
|
||
|
|
# 旧平面始终只报 v1。缺 v2 时不能借这个证书。
|
||
|
|
return {"dialogue": {key: {**evidence, "speech_silence_policy": gpu.SILENCE_POLICY},
|
||
|
|
"silence_policies": {evidence_policy: {key: evidence}}}}
|
||
|
|
return {"dialogue": {key: evidence}}
|
||
|
|
|
||
|
|
provider = SimpleNamespace(
|
||
|
|
settings=SimpleNamespace(dialogue_lipsync_enabled=True, inference_remote_files=False),
|
||
|
|
upstream_capabilities=capabilities,
|
||
|
|
_asset=lambda aid, paths: paths[aid],
|
||
|
|
)
|
||
|
|
paths = {aid: tracks for aid in (a, b, c, d)}
|
||
|
|
if allowed:
|
||
|
|
payload = await gpu.prepare(provider, task, inputs, p, paths)
|
||
|
|
assert payload["parameters"]["speech_silence_policy"] == (requested or "neutral-rest-v1")
|
||
|
|
else:
|
||
|
|
with pytest.raises(MediaError) as exc:
|
||
|
|
await gpu.prepare(provider, task, inputs, p, paths)
|
||
|
|
assert exc.value.code == "capability_unavailable"
|
||
|
|
|
||
|
|
|
||
|
|
def _preview_lipsync_request():
|
||
|
|
source, tracks, audio, speaker = (str(i) * 32 for i in range(1, 5))
|
||
|
|
return (
|
||
|
|
{
|
||
|
|
"video_asset_id": source,
|
||
|
|
"face_tracks_asset_id": tracks,
|
||
|
|
"speech_tracks": [
|
||
|
|
{"speaker_id": speaker, "target_track_id": speaker, "audio_asset_id": audio}
|
||
|
|
],
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"profile": "latentsync16-preview-v1",
|
||
|
|
"fps": 24,
|
||
|
|
"num_frames": 144,
|
||
|
|
"speech_silence_policy": "source-rest-v2",
|
||
|
|
"audio_context_shift_frames": 0,
|
||
|
|
"seed": 7,
|
||
|
|
},
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def test_latentsync_preview_only_accepts_the_bounded_sync_request():
|
||
|
|
inputs, params = _preview_lipsync_request()
|
||
|
|
validate_arguments("video.lipsync", inputs, params)
|
||
|
|
validate_arguments("video.lipsync", inputs, {**params, "num_frames": 1})
|
||
|
|
for change in (
|
||
|
|
{"num_frames": 0},
|
||
|
|
{"num_frames": 145},
|
||
|
|
{"audio_context_shift_frames": 1},
|
||
|
|
{"speech_silence_policy": "neutral-rest-v1"},
|
||
|
|
):
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments("video.lipsync", inputs, {**params, **change})
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments(
|
||
|
|
"video.lipsync", inputs, {k: v for k, v in params.items() if k != "speech_silence_policy"}
|
||
|
|
)
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments(
|
||
|
|
"video.dialogue.inspect", {**inputs, "base_video_asset_id": "5" * 32},
|
||
|
|
{k: v for k, v in params.items() if k != "audio_context_shift_frames"},
|
||
|
|
)
|
||
|
|
another_track = {"speaker_id": "5" * 32, "target_track_id": "5" * 32, "audio_asset_id": "6" * 32}
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
validate_arguments(
|
||
|
|
"video.lipsync", {**inputs, "speech_tracks": [*inputs["speech_tracks"], another_track]},
|
||
|
|
params,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
async def test_latentsync_preview_requires_exact_single_job_operator_ticket(tmp_path):
|
||
|
|
import hashlib
|
||
|
|
import json
|
||
|
|
import time
|
||
|
|
from types import SimpleNamespace
|
||
|
|
from app.adapters.provider import dialogue_gpu as gpu
|
||
|
|
|
||
|
|
inputs, params = _preview_lipsync_request()
|
||
|
|
owner, job = "a" * 32, "b" * 32
|
||
|
|
context = {"owner_id": owner, "job_id": job}
|
||
|
|
tracks = tmp_path / "tracks.json"
|
||
|
|
track = {"speaker_id": inputs["speech_tracks"][0]["speaker_id"]}
|
||
|
|
tracks.write_text(json.dumps({"decision": "pass", "tracks": [track]}))
|
||
|
|
paths = {aid: tracks for aid in [
|
||
|
|
inputs["video_asset_id"], inputs["face_tracks_asset_id"], inputs["speech_tracks"][0]["audio_asset_id"]
|
||
|
|
]}
|
||
|
|
|
||
|
|
async def capabilities():
|
||
|
|
return {"dialogue": {"lipsync": {
|
||
|
|
"available": True,
|
||
|
|
"profile": "musetalk-v15-v1",
|
||
|
|
"adapter_contract_version": "dialogue-v1",
|
||
|
|
"decision": "pass",
|
||
|
|
"task_type": "video.lipsync",
|
||
|
|
"revision": gpu.REVISIONS[gpu.SYNC],
|
||
|
|
"speech_silence_policy": "source-rest-v2",
|
||
|
|
"audio_context_shift_policy": "bounded-feature-shift-v1",
|
||
|
|
"mouth_blend_policy": "semantic-skin-ellipse-v1",
|
||
|
|
"max_people": 2,
|
||
|
|
"report_sha256": "c" * 64,
|
||
|
|
}}}
|
||
|
|
|
||
|
|
provider = SimpleNamespace(
|
||
|
|
settings=SimpleNamespace(
|
||
|
|
state_root=tmp_path, dialogue_lipsync_enabled=True, dialogue_two_faces_enabled=True,
|
||
|
|
inference_remote_files=False,
|
||
|
|
),
|
||
|
|
upstream_capabilities=capabilities,
|
||
|
|
_asset=lambda aid, assets: assets[aid],
|
||
|
|
)
|
||
|
|
task = "video.lipsync"
|
||
|
|
evidence = (await capabilities())["dialogue"]["lipsync"]
|
||
|
|
assert not gpu.certified(task, {**evidence, "profile": params["profile"]})
|
||
|
|
with pytest.raises(MediaError) as no_ticket:
|
||
|
|
await gpu.prepare(provider, task, inputs, params, paths, context)
|
||
|
|
assert no_ticket.value.code == "capability_unavailable"
|
||
|
|
|
||
|
|
key = hashlib.sha256(json.dumps(
|
||
|
|
[task, inputs, params], sort_keys=True, separators=(",", ":"), ensure_ascii=False
|
||
|
|
).encode()).hexdigest()
|
||
|
|
folder = tmp_path / "dialogue-calibration"
|
||
|
|
folder.mkdir()
|
||
|
|
(folder / (key + ".json")).write_text(json.dumps(
|
||
|
|
{"owner_id": owner, "expires_at": time.time() + 600, "sha256": key}
|
||
|
|
))
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
await gpu.prepare(provider, task, inputs, params, paths, {**context, "owner_id": "c" * 32})
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
await gpu.prepare(provider, task, inputs, {**params, "seed": 8}, paths, context)
|
||
|
|
payload = await gpu.prepare(provider, task, inputs, params, paths, context)
|
||
|
|
assert payload["parameters"] == params
|
||
|
|
assert await gpu.prepare(provider, task, inputs, params, paths, context) == payload
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
await gpu.prepare(provider, task, inputs, params, paths, {**context, "job_id": "d" * 32})
|
||
|
|
|
||
|
|
tracks.write_text(json.dumps({"decision": "pass", "tracks": [track, {"speaker_id": "e" * 32}]}))
|
||
|
|
with pytest.raises(MediaError):
|
||
|
|
await gpu.prepare(provider, task, inputs, params, paths, context)
|