Private
Public Access
test(llama): adapt 3 tests to Result API (doeh cleanup Phase 2.2)
This commit is contained in:
@@ -26,7 +26,7 @@ def test_send_llama_ollama_backend(monkeypatch: pytest.MonkeyPatch) -> None:
|
|||||||
mock_requests.post.return_value = mock_response
|
mock_requests.post.return_value = mock_response
|
||||||
with patch("src.ai_client._require_warmed", return_value=mock_requests):
|
with patch("src.ai_client._require_warmed", return_value=mock_requests):
|
||||||
result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None)
|
result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None)
|
||||||
assert "hi from ollama" in result
|
assert result.ok and "hi from ollama" in result.data
|
||||||
called_url = mock_requests.post.call_args.args[0]
|
called_url = mock_requests.post.call_args.args[0]
|
||||||
assert called_url == "http://localhost:11434/api/chat"
|
assert called_url == "http://localhost:11434/api/chat"
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ def test_send_llama_openrouter_backend(monkeypatch: pytest.MonkeyPatch) -> None:
|
|||||||
)
|
)
|
||||||
with patch("src.ai_client._ensure_llama_client", return_value=captured_client) as ensure:
|
with patch("src.ai_client._ensure_llama_client", return_value=captured_client) as ensure:
|
||||||
result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None)
|
result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None)
|
||||||
assert result == "hi from openrouter"
|
assert result.ok and result.data == "hi from openrouter"
|
||||||
assert ensure.called
|
assert ensure.called
|
||||||
|
|
||||||
def test_send_llama_custom_url(monkeypatch: pytest.MonkeyPatch) -> None:
|
def test_send_llama_custom_url(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||||
@@ -52,7 +52,7 @@ def test_send_llama_custom_url(monkeypatch: pytest.MonkeyPatch) -> None:
|
|||||||
)
|
)
|
||||||
with patch("src.ai_client._ensure_llama_client", return_value=mock_client):
|
with patch("src.ai_client._ensure_llama_client", return_value=mock_client):
|
||||||
result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None)
|
result = ai_client._send_llama("system", "user", ".", None, "", False, None, None, None)
|
||||||
assert result == "hi from custom"
|
assert result.ok and result.data == "hi from custom"
|
||||||
|
|
||||||
def test_llama_model_discovery_unions_ollama_and_openrouter() -> None:
|
def test_llama_model_discovery_unions_ollama_and_openrouter() -> None:
|
||||||
from src.ai_client import _list_llama_models
|
from src.ai_client import _list_llama_models
|
||||||
|
|||||||
Reference in New Issue
Block a user