clipwright/tests/conftest.py
juancarlos.cavero f10655fd1c feat(agents): the pipeline as a platform — API keys, MCP server, webhooks
Agents don't forget to come back; humans do. Make the whole pipeline
drivable without the dashboard:

- API keys (osk_...): sha256-stored tokens minted from the account page.
  get_current_user_optional resolves them like a session, so metering,
  entitlement, priority and job ownership apply to agents with zero
  endpoint changes. Key management refuses API-key auth (a leaked key
  cannot mint replacements).
- MCP server at /mcp: stateless Streamable-HTTP JSON-RPC, no SDK
  dependency. Six tools (process_video, get_job_status, list_clips,
  get_quota, add_subtitles, publish_clip) that call back into this same
  app in-process via ASGITransport with the caller's auth headers, so
  MCP can never drift from REST behavior. Cloud requires a key;
  self-host stays BYOK-open.
- Completion webhooks: webhook_url (+ optional HMAC webhook_secret) on
  /api/process, SSRF-checked at submit AND delivery, fired once after
  the R2 archive so payloads carry durable links, survives redeploys
  via the resume manifest.
- Dashboard: API keys card in the account page (create once-shown key,
  list, revoke).
- Tests pin BILLING_ENABLED=0 in conftest so the suite no longer
  depends on the developer's personal .env.
2026-08-03 22:33:16 +02:00

11 lines
515 B
Python

import os
import sys
# Make the repo root importable so tests can import the app modules directly.
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Tests always run the app in self-host (BYOK) mode. app.py freezes
# BILLING_ENABLED at import time and load_dotenv never overrides an existing
# variable, so this must be set here — before any test module imports app — or
# the suite's behavior would depend on the developer's personal .env.
os.environ["BILLING_ENABLED"] = "0"