Fix tests: ConnectionKey not MagicMock
Co-authored-by: alpha-nerd <alpha-nerd@users.noreply.bitfreedom.net>
This commit is contained in:
parent
6d7c51e327
commit
0d2da579c5
2 changed files with 26 additions and 2 deletions
|
|
@ -73,12 +73,24 @@ class TestFetchAvailableModels:
|
|||
|
||||
async def test_returns_empty_on_connection_error(self):
|
||||
cfg = _make_cfg(ollama_eps=[MOCK_OLLAMA_EP], llama_eps=[])
|
||||
from aiohttp.connector import ConnectionKey
|
||||
import aiohttp
|
||||
with patch.object(router, "config", cfg), aioresponses() as m:
|
||||
conn_key = ConnectionKey(
|
||||
host="mock-ollama",
|
||||
port=11434,
|
||||
is_ssl=False,
|
||||
ssl=None,
|
||||
proxy=None,
|
||||
proxy_host=None,
|
||||
proxy_port=None,
|
||||
proxy_auth=None,
|
||||
connector_owner=True,
|
||||
)
|
||||
m.get(
|
||||
f"{MOCK_OLLAMA_EP}/api/tags",
|
||||
exception=aiohttp.ClientConnectorError(
|
||||
connection_key=MagicMock(host="mock-ollama", port=11434),
|
||||
connection_key=conn_key,
|
||||
os_error=OSError(111, "refused"),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue