ReMe/tests/unit/test_client_info.py
jinliyl 54fa3381d7
Some checks failed
CI and Release / Docker / Build and test / amd64 (push) Has been cancelled
CI and Release / Docker / Build and test / arm64 (push) Has been cancelled
Security / CodeQL / Analyze python (push) Has been cancelled
CI / Python quality / Pre-commit (push) Has been cancelled
CI / Python tests / Unit Tests - py3.12 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.13 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.14 (push) Has been cancelled
CI / Python packages / Build and verify distributions (push) Has been cancelled
CI / Python quality / GitHub Actions (push) Has been cancelled
CI / Python tests / Hermes embedded - ubuntu-latest (push) Has been cancelled
CI / Python tests / Hermes embedded - windows-latest (push) Has been cancelled
CI / Python tests / Unit Tests - py3.11 (push) Has been cancelled
CI / ReMe Studio / Studio checks (push) Has been cancelled
Deploy / Documentation / Build documentation (push) Has been cancelled
CI / Windows / CLI smoke - py3.11 (push) Has been cancelled
Security / CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI and Release / Docker / Publish multi-platform tags (push) Has been cancelled
Deploy / Documentation / deploy (push) Has been cancelled
refactor(core): reorganize the ReMe runtime and shared helpers (#769)
* refactor(core): reorganize the ReMe runtime and shared helpers

* test(status): import the base component from its canonical module

* test: remove redundant unit checks

* refactor(core): use canonical runtime imports and shared CLI discovery

Restore evolve behavior to the base branch and update its imports. Use Application as the runtime entry point and encode SSE in the HTTP service.

* fix(cli): honor caller config when service replay is incomplete

Use partial startup overrides for port probes and resolve named configs before requesting the service process working directory.
2026-11-20 22:06:46 +08:00

43 lines
1.9 KiB
Python

"""The desktop discovers public capabilities without depending on backend wiring."""
# pylint: disable=missing-function-docstring
from types import SimpleNamespace
import pytest
from reme.core.context import ApplicationContext
from reme.schema.agent_view import ClientInfo
from reme.steps.common.app_config import ClientInfoStep
@pytest.mark.asyncio
async def test_client_info_respects_service_jobs_and_exposes_no_component_configuration(tmp_path):
context = ApplicationContext(
workspace_dir=str(tmp_path),
jobs={
"ask_agent": {"backend": "stream"},
"asr": {"backend": "base"},
"tts": {"backend": "base"},
"disabled": {"enabled": False},
"private": {"enable_serve": False},
"worker": {"backend": "background"},
},
components={
"file_store": {"default": {"tag_index": "custom"}},
"tag_index": {"custom": {"tag_key": "topics"}},
"tts": {"default": {"model": "voice-model", "voice": "voice-1", "api_key": "secret"}},
},
)
step = ClientInfoStep(app_context=context)
value = ClientInfo.model_validate((await step()).answer)
assert value.jobs == ["ask_agent", "asr", "tts"]
assert value.asr and value.tts and value.tag_key == "topics"
assert value.workspace_dir == str(tmp_path) and value.daily_dir == "daily"
assert "secret" not in value.model_dump_json() and "components" not in value.model_dump_json()
context.service = SimpleNamespace(jobs={"ask_agent"})
limited = ClientInfo.model_validate((await step()).answer)
assert limited.jobs == ["ask_agent"] and not limited.asr and not limited.tts
assert limited.speech_revision == value.speech_revision
context.app_config.components["tts"]["default"].voice = "voice-2"
assert (await step()).answer["speech_revision"] != value.speech_revision