test: cover existing managed sample resolution

parent c6fa03b7
...@@ -4,6 +4,7 @@ from tools.manual_multimodal_test_client import ( ...@@ -4,6 +4,7 @@ from tools.manual_multimodal_test_client import (
build_request_spec, build_request_spec,
build_parser, build_parser,
choose_mode_interactively, choose_mode_interactively,
ensure_sample_file,
execute_request, execute_request,
handle_response_payload, handle_response_payload,
parse_args, parse_args,
...@@ -126,6 +127,23 @@ def test_resolve_mode_config_keeps_explicit_empty_string_overrides(tmp_path): ...@@ -126,6 +127,23 @@ def test_resolve_mode_config_keeps_explicit_empty_string_overrides(tmp_path):
assert config["response_format"] == "" assert config["response_format"] == ""
def test_ensure_sample_file_returns_existing_path_without_download(tmp_path, monkeypatch):
sample_path = tmp_path / "samples" / "transcription.wav"
sample_path.parent.mkdir(parents=True)
sample_path.write_bytes(b"wav-bytes")
calls = []
monkeypatch.setattr(
"tools.manual_multimodal_test_client.download_default_sample",
lambda path: calls.append(path),
)
result = ensure_sample_file(str(sample_path), "--audio-file")
assert result == sample_path
assert calls == []
def test_build_request_spec_for_llm_uses_chat_completions_payload(tmp_path): def test_build_request_spec_for_llm_uses_chat_completions_payload(tmp_path):
config = { config = {
"mode": "llm", "mode": "llm",
......
...@@ -53,6 +53,13 @@ MODE_DEFAULTS = { ...@@ -53,6 +53,13 @@ MODE_DEFAULTS = {
} }
SAMPLE_URLS = {
"samples/transcription.wav": "https://example.invalid/transcription.wav",
"samples/question-video.mp4": "https://example.invalid/question-video.mp4",
"samples/question-audio.wav": "https://example.invalid/question-audio.wav",
}
def build_parser() -> argparse.ArgumentParser: def build_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser(description="Manual multimodal smoke-test client") parser = argparse.ArgumentParser(description="Manual multimodal smoke-test client")
parser.add_argument("mode", nargs="?", choices=MODES) parser.add_argument("mode", nargs="?", choices=MODES)
...@@ -95,6 +102,19 @@ def _require_file(path_value: str | None, flag_name: str) -> Path: ...@@ -95,6 +102,19 @@ def _require_file(path_value: str | None, flag_name: str) -> Path:
return path return path
def download_default_sample(path: Path) -> Path:
raise NotImplementedError
def ensure_sample_file(path_value: str | None, flag_name: str) -> Path:
if not path_value:
raise FileNotFoundError(f"Missing required file. Supply {flag_name}.")
path = Path(path_value)
if path.exists():
return path
raise FileNotFoundError(f"File not found: {path}. Supply {flag_name}.")
def build_request_spec(config: dict) -> dict: def build_request_spec(config: dict) -> dict:
mode = config["mode"] mode = config["mode"]
headers = {"Accept": "application/json"} headers = {"Accept": "application/json"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment