feat: publish CodexPi contest snapshot
Some checks are pending
Qualité / tests (push) Waiting to run

This commit is contained in:
CodexPi
2026-11-14 20:23:59 +01:00
commit 995b17a6e2
295 changed files with 36803 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import asyncio
from codexpi import agent_service
from codexpi.commands import CommandResult
def test_agent_accounts_status_detects_connections(monkeypatch):
monkeypatch.setattr(agent_service.shutil, "which", lambda binary: f"/usr/bin/{binary}")
async def fake_run(argv, **_kwargs):
binary = argv[0].rsplit("/", 1)[-1]
if binary == "codex":
return CommandResult(argv, 0, "Logged in using ChatGPT\n", "")
if binary == "claude":
return CommandResult(argv, 0, '{"loggedIn":false}', "")
return CommandResult(argv, 0, "0 credentials", "")
monkeypatch.setattr(agent_service, "run_command", fake_run)
rows = asyncio.run(agent_service.agent_accounts_status("codex", "claude", "opencode"))
assert [row["id"] for row in rows] == ["codex", "claude", "opencode"]
assert rows[0]["connected"] is True
assert rows[0]["account"] == "Logged in using ChatGPT"
assert rows[1]["connected"] is False
assert rows[2]["connected"] is False
def test_agent_accounts_status_reports_missing_binary(monkeypatch):
monkeypatch.setattr(agent_service.shutil, "which", lambda _binary: None)
rows = asyncio.run(agent_service.agent_accounts_status("codex", "claude", "opencode"))
assert all(row["installed"] is False for row in rows)
assert rows[1]["command"] == "claude auth login"