Files
ECC/skills/taste-application/tests/test_providers.py
T
928c1dea72 feat(tasteforge): package reusable workflows and preserve native edits (#3033)
* feat: bundle standalone taste distillation and application workflows

* docs: fix imported taste skill markdown lint

* docs: align Turkish agent catalog with taste skills

* refactor: make ECC the canonical reusable video engine

* fix: preserve video duration when applying image overlays

* fix: preserve background colors in image compositing

* fix: report best-effort duration targets and shortfalls

* feat: ship verified Fusion presets with compatibility provenance

* feat(tasteforge): preserve native edits in application bundles

* feat(tasteforge): compile local preservation without hosted input

* fix: update js-yaml to patched 4.3.2

* test: report bounded Stop wrapper failure diagnostics

* fix(tasteforge): fail closed on unsafe output names, missing overlays and cadence

- cli: default report and spec paths are derived from pack name and profile
  genre; require the manifest's name pattern before using either as a
  filename part so a traversal string cannot write outside cwd/out.
- apply_local: a pack without cadence.json, or with no measured shots and
  no explicit mean_shot, raises instead of silently planning 1.0s shots and
  reporting a measured cadence.
- legacy apply: a missing overlay aborts before any paid upload; forge()
  would have rejected it after every take was generated.
- requirements-live: pin fal-client>=0.13.0, the first release whose
  subscribe() accepts client_timeout.

Addresses the five P1 findings from the independent review of #3033.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015fxHRsydPqEcYngGbqkgt1

---------

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-10 15:31:36 +01:00

52 lines
1.7 KiB
Python

"""Failing-first tests: provider adapters must fail closed, always."""
from __future__ import annotations
import sys
import unittest
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1] / "scripts"
sys.path.insert(0, str(REPO_ROOT))
from tasteforge import providers # noqa: E402
class RegistryFailClosedTests(unittest.TestCase):
def test_default_registry_has_no_providers(self):
self.assertEqual(providers.list_providers(), [])
def test_get_unknown_provider_raises_not_authorized(self):
with self.assertRaises(providers.ProviderNotAuthorizedError) as ctx:
providers.get("fal")
self.assertIn("separately authorized", str(ctx.exception))
def test_env_flag_alone_does_not_enable(self):
import os
old = os.environ.get("TASTEFORGE_ALLOW_PROVIDERS")
os.environ["TASTEFORGE_ALLOW_PROVIDERS"] = "1"
try:
with self.assertRaises(providers.ProviderNotAuthorizedError):
providers.get("fal")
finally:
if old is None:
del os.environ["TASTEFORGE_ALLOW_PROVIDERS"]
else:
os.environ["TASTEFORGE_ALLOW_PROVIDERS"] = old
def test_explicit_registration_requires_authorization_flag(self):
with self.assertRaises(providers.ProviderNotAuthorizedError):
providers.register(
"fal",
callable_factory=lambda: (_ for _ in ()).throw(AssertionError("never")),
)
def test_no_network_modules_imported(self):
for mod in ("fal_client", "requests", "http.client", "urllib.request"):
self.assertNotIn(mod, sys.modules, f"{mod} must not be imported by tasteforge")
if __name__ == "__main__":
unittest.main()