feat(translation): "Test connection" button — on-demand Interpreter health check (#143)
New POST /api/settings/translation/test pings /v1/health for a GIVEN base URL (not the saved one), so the operator can verify a URL before enabling it. TranslationCard gains a Test-connection button that reports reachable/unreachable inline and updates the status dot. Endpoint test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CDgx8bQS5YrGRK76v8HUnM
This commit is contained in:
@@ -69,6 +69,20 @@ async def test_translation_run_requires_config(client):
|
||||
assert resp.status_code == 400 # disabled / no base URL
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_translation_test_connection(client, monkeypatch):
|
||||
# Tests a GIVEN url (not the saved one) without persisting anything.
|
||||
monkeypatch.setattr("backend.app.api.settings.ic.health", lambda *a, **k: True)
|
||||
resp = await client.post(
|
||||
"/api/settings/translation/test", json={"base_url": "http://i.lan"})
|
||||
assert resp.status_code == 200
|
||||
assert (await resp.get_json())["healthy"] is True
|
||||
# Empty URL → False, no health call.
|
||||
empty = await client.post(
|
||||
"/api/settings/translation/test", json={"base_url": ""})
|
||||
assert (await empty.get_json())["healthy"] is False
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_translation_run_enqueues_when_configured(client, monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
|
||||
Reference in New Issue
Block a user