Incluye 'yaml' en los overrides de mypy (PyYAML no trae type stubs). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
37 lines
1021 B
Python
37 lines
1021 B
Python
"""Tests del PolicyStore."""
|
|
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from agentforge_core.registry.policy_store import FileSystemPolicyStore
|
|
|
|
FIXTURES = Path(__file__).parent.parent / "fixtures" / "policies"
|
|
|
|
|
|
def test_list_policies() -> None:
|
|
store = FileSystemPolicyStore(FIXTURES)
|
|
names = [p.name for p in store.list_policies()]
|
|
assert "test_policy" in names
|
|
|
|
|
|
def test_get_policy_devuelve_version_activa() -> None:
|
|
store = FileSystemPolicyStore(FIXTURES)
|
|
p = store.get_policy("test_policy")
|
|
assert p.version == "v1"
|
|
assert len(p.input_validators) == 1
|
|
assert p.input_validators[0].type == "detect_pii"
|
|
|
|
|
|
def test_get_policy_inexistente_lanza_error() -> None:
|
|
store = FileSystemPolicyStore(FIXTURES)
|
|
with pytest.raises(FileNotFoundError):
|
|
store.get_policy("inexistente")
|
|
|
|
|
|
def test_list_versions() -> None:
|
|
store = FileSystemPolicyStore(FIXTURES)
|
|
metas = store.list_versions("test_policy")
|
|
assert metas[0].id == "v1"
|
|
assert metas[0].author == "pytest"
|