Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
import json
from typer.testing import CliRunner
from dodaios.cli_ctl.__main__ import app
runner = CliRunner()
def test_version_runs_without_server():
res = runner.invoke(app, ["version"])
assert res.exit_code == 0
assert "dodaiosctl" in res.stdout
# The earlier name still runs it, and is the name it answers with.
res = runner.invoke(app, ["version"], prog_name="jarvisctl")
assert res.exit_code == 0
assert res.stdout.startswith("jarvisctl ")
def test_login_stores_key_after_successful_probe(mock_api, tmp_path):
mock_api[("GET", "/api/control/auth/probe")] = (200, {"ok": True})
res = runner.invoke(
app, ["auth", "login", "--url", "http://h:1", "--key", "jctl_x"]
)
assert res.exit_code == 0
saved = json.loads(
(tmp_path / "cfg" / "config.json").read_text(encoding="utf-8")
)
assert saved["control_key"] == "jctl_x"
def test_login_rejects_bad_key(mock_api):
mock_api[("GET", "/api/control/auth/probe")] = (401, {"detail": "bad"})
res = runner.invoke(
app, ["auth", "login", "--url", "http://h:1", "--key", "wrong"]
)
assert res.exit_code == 1
def test_login_reads_key_from_stdin(mock_api, tmp_path):
"""`--key -` reads the key from stdin so it never lands in shell history."""
mock_api[("GET", "/api/control/auth/probe")] = (200, {"ok": True})
res = runner.invoke(
app, ["auth", "login", "--url", "http://h:1", "--key", "-"],
input="jctl_stdin\n",
)
assert res.exit_code == 0
saved = json.loads(
(tmp_path / "cfg" / "config.json").read_text(encoding="utf-8")
)
assert saved["control_key"] == "jctl_stdin"
def test_login_prompts_when_key_omitted(mock_api, tmp_path):
"""Omitting --key prompts (hidden) instead of requiring an inline value."""
mock_api[("GET", "/api/control/auth/probe")] = (200, {"ok": True})
res = runner.invoke(
app, ["auth", "login", "--url", "http://h:1"], input="jctl_prompted\n"
)
assert res.exit_code == 0
saved = json.loads(
(tmp_path / "cfg" / "config.json").read_text(encoding="utf-8")
)
assert saved["control_key"] == "jctl_prompted"
def test_status_reports_reachability(mock_api):
mock_api[("GET", "/api/control/auth/probe")] = (200, {"ok": True})
res = runner.invoke(
app, ["--json", "auth", "status", "--url", "http://h:1", "--key", "jctl_x"]
)
assert res.exit_code == 0
assert json.loads(res.stdout)["reachable"] is True