Files
devplacepy/tests/unit/services/containers/backend/docker_cli.py
T
retoorandClaude Sonnet 5.5 f55c7ee5f4 Add community node protocol spec, Agent Skills, and make the failing tests hermetic
Community nodes (Phase 1 of plan.md): the protocol specification in
services/nodes/spec.py as the single source of truth, GET /nodes/spec.json,
a generated protocol docs page, the Community nodes API docs group, and the
implementation plan plus the residential proxy research. The no-open-proxy rule
is enforced in the spec (open_proxy cannot be set).

Agent Skills: register the Skills API docs group, cascade skills on account
deletion, add the nested CLAUDE.md, README and routes docs, and cover the
parser, the fetcher (end to end against a mock origin), the data layer and the
routes with 73 unit and 16 api tests.

Tests made hermetic with the repo's existing patterns instead of ambient
environment: embeddings tests set OPENROUTER_API_KEY via monkeypatch, the
workspace tests install FakeBackend via runtime.set_backend, and the skills
install tests use run_async. DockerCliBackend now returns 127 (command not
found) when the CLI is missing instead of raising FileNotFoundError, so a host
without docker answers with a clean error rather than a 500. The Providers tab
empty state no longer names the Model routes tab.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 07:13:25 +02:00

45 lines
1.3 KiB
Python

# retoor <retoor@molodetz.nl>
from devplacepy.services.containers.backend.docker_cli import (
COMMAND_NOT_FOUND,
DockerCliBackend,
)
from tests.conftest import run_async
MISSING = "devplace-no-such-container-cli"
def test_a_missing_cli_is_a_command_not_found_result_not_an_exception():
backend = DockerCliBackend(binary=MISSING)
code, out, err = run_async(backend._run([MISSING, "ps"]))
assert code == COMMAND_NOT_FOUND == 127
assert out == ""
assert MISSING in err and "not found" in err
def test_a_missing_cli_means_the_image_does_not_exist():
backend = DockerCliBackend(binary=MISSING)
assert run_async(backend.image_exists("ppy:latest")) is False
def test_a_missing_cli_reports_through_the_stream_callback():
backend = DockerCliBackend(binary=MISSING)
lines = []
async def on_log(line):
lines.append(line)
code = run_async(backend._stream([MISSING, "run"], on_log))
assert code == COMMAND_NOT_FOUND
assert lines == [f"{MISSING}: command not found"]
def test_a_failing_check_names_the_missing_cli():
backend = DockerCliBackend(binary=MISSING)
try:
run_async(backend._check([MISSING, "info"]))
except RuntimeError as exc:
assert "127" in str(exc) and "not found" in str(exc)
else:
raise AssertionError("expected a RuntimeError")