Files
Octop/tests/unit/api/test_setup_main_agent.py
2209cdc90f chore(deps): switch runtime packages to octop-* 1.0.0 (#1136)
Replace orcakit-harness-agent / harness-* with octop-harness, octop-gateway, octop-memory, and octop-browser, and align docs, UI copy, and generated paths.

Co-authored-by: jubaoliang <jubaoliang@tencent.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-25 06:44:24 +08:00

48 lines
1.6 KiB
Python

"""Regression coverage for setup's default ``main`` agent."""
from __future__ import annotations
import os
import tempfile
import pytest
from octop_harness.backends import resolve_backend
from octop_harness.backends.workspace import BackendWorkspace
from octop.infra.agents.experts.catalog import ExpertCatalog, default_library_root
def test_bootstrap_main_spec_en_locale_uses_english_label() -> None:
from octop.infra.agents.experts.catalog import (
build_create_spec_from_expert,
)
catalog = ExpertCatalog(default_library_root())
catalog.refresh()
expert = catalog.get("general-assistant")
assert expert is not None
spec = build_create_spec_from_expert(
expert_id="general-assistant",
expert=expert,
user_id=1,
agent_id="main",
locale="en",
)
expected_name = expert.summary.label_en or expert.summary.label_zh
assert spec.name == expected_name
if expert.summary.description_en:
assert spec.description == expert.summary.description_en
@pytest.mark.asyncio
async def test_virtual_mode_without_root_dir_defaults_to_workspace() -> None:
"""``root_dir`` omitted → harness uses ``workspace_dir``; files land in workspace."""
with tempfile.TemporaryDirectory() as ws_dir:
backend = resolve_backend(
{"type": "local_shell", "virtual_mode": True},
workspace_dir=ws_dir,
)
ws = BackendWorkspace(backend, ws_dir)
await ws.aupload_bytes("SOUL.md", b"# soul")
assert os.path.isfile(os.path.join(ws_dir, "SOUL.md"))