mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-09 05:50:44 +08:00
- Rename platform/ to svc/ to avoid shadowing stdlib platform. - Replace from oclaw.* with from svc/runtime/interfaces; update -m CLI paths. - tests/conftest: prepend repo root to sys.path (no parent-folder package name). - CI: paths and offline_eval script under repo root. - Ops scripts: PYTHONPATH must be repo root for python -m runtime.* (fixes gateway/WhatsApp sidecar startup). - Fix default oclaw.json path in tabular/file attachment limits; stabilize attachment test config. Co-authored-by: Cursor <cursoragent@cursor.com>
30 lines
888 B
Python
30 lines
888 B
Python
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
|
|
from svc.persistence.sqlite_store import SqliteStore
|
|
|
|
|
|
def test_oclaw_task_status_flow(tmp_path: Path) -> None:
|
|
store = SqliteStore(str(tmp_path / "task.sqlite"))
|
|
task = store.oclaw_task_create(
|
|
tenant_id="tenant-a",
|
|
session_id="session-a",
|
|
payload={"text": "hello"},
|
|
)
|
|
assert task.status == "queued"
|
|
|
|
claimed = store.oclaw_task_claim(worker_id="worker-1")
|
|
assert claimed is not None
|
|
assert claimed.id == task.id
|
|
assert claimed.status == "claimed"
|
|
assert claimed.claimed_by == "worker-1"
|
|
assert claimed.attempt_count >= 1
|
|
|
|
ok = store.oclaw_task_finish(task_id=task.id, result={"reply_text": "done"})
|
|
assert ok
|
|
done = store.oclaw_task_get(task_id=task.id)
|
|
assert done is not None
|
|
assert done.status == "done"
|
|
assert "done" in done.result
|
|
|