Skip to content

"Vibe-Trading: Your Personal Trading Agent"

test(cli): select init providers by identity

Haozhe Wu70f3d809e968
diff --git a/agent/tests/test_cli_init.py b/agent/tests/test_cli_init.py
index 74af91521..95de0ee4c 100644
--- a/agent/tests/test_cli_init.py
+++ b/agent/tests/test_cli_init.py
@@ -6,6 +6,15 @@ from unittest.mock import patch
import cli
+def _provider_choice_number(provider: str) -> int:
+ """Return the rendered one-based menu number for a provider."""
+ return next(
+ index
+ for index, choice in enumerate(cli._PROVIDER_CHOICES, start=1)
+ if choice["provider"] == provider
+ )
+
+
class TestCliInit:
def test_render_env_content_openrouter(self) -> None:
content = cli._render_env_content(
@@ -81,7 +90,11 @@ class TestCliInit:
env_path = tmp_path / ".env"
with patch.object(cli, "_INIT_ENV_PATH", env_path), \
- patch.object(cli.IntPrompt, "ask", return_value=17), \
+ patch.object(
+ cli.IntPrompt,
+ "ask",
+ return_value=_provider_choice_number("ollama"),
+ ), \
patch.object(
cli.Prompt,
"ask",
@@ -106,7 +119,11 @@ class TestCliInit:
env_path = tmp_path / ".env"
with patch.object(cli, "_INIT_ENV_PATH", env_path), \
- patch.object(cli.IntPrompt, "ask", return_value=18), \
+ patch.object(
+ cli.IntPrompt,
+ "ask",
+ return_value=_provider_choice_number("openai-codex"),
+ ), \
patch.object(
cli.Prompt,
"ask",