forked from retoor/devplacepy
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>
35 lines
1018 B
Python
35 lines
1018 B
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
import requests
|
|
from tests.api.uploads.uploadurl import _key, _upload_settings # noqa: F401
|
|
from tests.conftest import BASE_URL
|
|
|
|
|
|
def test_generate_image_requires_auth():
|
|
response = requests.post(f"{BASE_URL}/uploads/generate-image", data={"prompt": "a cat"})
|
|
assert response.status_code == 401
|
|
|
|
|
|
def test_generate_image_rejects_empty_prompt():
|
|
response = requests.post(
|
|
f"{BASE_URL}/uploads/generate-image",
|
|
headers={"X-API-KEY": _key()},
|
|
data={"prompt": ""},
|
|
allow_redirects=False,
|
|
)
|
|
assert response.status_code != 201
|
|
|
|
|
|
def test_generate_image_upstream_failure_is_a_clean_json_error():
|
|
response = requests.post(
|
|
f"{BASE_URL}/uploads/generate-image",
|
|
headers={"X-API-KEY": _key()},
|
|
data={"prompt": "a lighthouse at dusk"},
|
|
)
|
|
assert response.status_code in (201, 502)
|
|
body = response.json()
|
|
if response.status_code == 502:
|
|
assert body["error"]
|
|
else:
|
|
assert body["uid"]
|