mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-19 13:22:20 +02:00
Consolidate Odysseus agent harness and tool contracts
This commit is contained in:
@@ -57,3 +57,33 @@ async def test_failed_server_discovery_does_not_claim_complete_local_only_invent
|
||||
result = await do_list_cached_models('{}', owner='alice')
|
||||
assert result['models'][0]['repo_id'] == 'fixture/local'
|
||||
assert result['exit_code'] == 1 and result['partial']
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_named_server_retries_its_ssh_alias_when_saved_address_is_stale(monkeypatch):
|
||||
from src import tool_implementations
|
||||
monkeypatch.setattr(tool_implementations, '_internal_headers', lambda: {})
|
||||
client = httpx.AsyncClient
|
||||
|
||||
def respond(request):
|
||||
if request.url.path == '/api/cookbook/state':
|
||||
return httpx.Response(200, json={'env': {'servers': [
|
||||
{'name': 'Ajax', 'host': 'pewds@192.168.1.9'},
|
||||
]}})
|
||||
if request.url.params.get('host') == 'pewds@192.168.1.9':
|
||||
return httpx.Response(200, json={
|
||||
'models': [], 'error': 'ssh: connect to host 192.168.1.9 port 22: timed out',
|
||||
})
|
||||
if request.url.params.get('host') == 'Ajax':
|
||||
return httpx.Response(200, json={'models': [{
|
||||
'repo_id': 'fixture/model', 'size': '1 GB', 'nb_files': 1,
|
||||
'has_incomplete': False,
|
||||
}]})
|
||||
raise AssertionError(f'unexpected request: {request.url}')
|
||||
|
||||
monkeypatch.setattr(httpx, 'AsyncClient', lambda **kwargs: client(
|
||||
transport=httpx.MockTransport(respond), **kwargs))
|
||||
result = await do_list_cached_models('{"host":"Ajax"}', owner='alice')
|
||||
assert result['exit_code'] == 0
|
||||
assert result['models'][0]['repo_id'] == 'fixture/model'
|
||||
assert not result.get('scan_errors')
|
||||
|
||||
Reference in New Issue
Block a user