fix: close lifecycle and diagnostic review regressions

This commit is contained in:
Palash Debnath
2026-09-17 12:47:08 +05:30
parent a390da1590
commit a9195b8e40
2 changed files with 7 additions and 6 deletions
@@ -200,7 +200,7 @@ def test_audiocpp_runtime_installer_routes_are_desktop_scoped(
)
client = _client(fresh_app)
assert client.get("/engines/audiocpp/runtime/install/status").json() == payload
assert client.get("/engines/audiocpp/runtime/install/status").json() == {**payload, "install_allowed": True}
response = client.post("/engines/audiocpp/runtime/install")
assert response.status_code == 200
assert response.json()["status"] == "started"
+6 -5
View File
@@ -1,14 +1,13 @@
import httpx
import pytest
from fastapi import FastAPI
from api.dependencies import require_admin
from api.routers import engines
from services import sidecar_install, audiocpp_runtime_install
@pytest.mark.asyncio
@pytest.mark.parametrize('host,allowed', [('127.0.0.1', True), ('::1', True), ('192.0.2.10', False)])
async def test_catalogue_matches_native_install_boundary(host, allowed, monkeypatch):
from api.routers import engines
from services import sidecar_install, audiocpp_runtime_install
payload = {'backends': [{'id': 'example', 'one_click_install': True, 'available': False}]}
monkeypatch.setattr(engines, '_family_payload', lambda *args: payload)
monkeypatch.setattr(sidecar_install, 'get_status', lambda engine: {'installed': False, 'job': None})
@@ -18,14 +17,16 @@ async def test_catalogue_matches_native_install_boundary(host, allowed, monkeypa
monkeypatch.setattr(audiocpp_runtime_install, 'start_install', lambda: calls.append('native') or {'status': 'started'})
app = FastAPI()
app.include_router(engines.router)
app.dependency_overrides[require_admin] = lambda: None
app.dependency_overrides[engines.require_admin] = lambda: None
async with httpx.AsyncClient(transport=httpx.ASGITransport(app=app, client=(host, 1234)), base_url='http://test') as client:
listing = (await client.get('/engines')).json()['tts']['backends'][0]
assert listing['one_click_install'] is allowed
assert listing.get('local_install_required', False) is (not allowed)
assert payload['backends'][0]['one_click_install'] is True # no cached registry mutation
for path in ['/engines/sidecar/example/install', '/engines/audiocpp/runtime/install']:
status = (await client.get(path + '/status')).json()
response = await client.get(path + '/status')
assert response.status_code == 200, response.text
status = response.json()
assert status['install_allowed'] is allowed
response = await client.post(path)
assert response.status_code == (200 if allowed else 403)