sentinel-scam-honeypo / tests /orchestration /test_switchboard_adaptive.py
avinash-rai's picture
Deployment Ready: Fixed scam detection low confidence, added production audit report, optimized throttles
1838600
raw
history blame contribute delete
1.48 kB
"""
Orchestration Tests: Switchboard Adaptive
Tests that model registry correctly handles fallback scenarios.
Updated to match current architecture without _switchboard method.
"""
import pytest
from app.core.model_registry import model_registry, Capability
@pytest.mark.asyncio
async def test_fallback_chain_for_context():
"""
Validates that fallback chains exist for high-context scenarios.
"""
# Get fallback chain
chain = model_registry.get_fallback_chain("groq", "FAST_CHAT")
assert chain is not None
assert len(chain) > 0
# Chain should have multiple options
assert isinstance(chain, list)
@pytest.mark.asyncio
async def test_fallback_chain_for_structured():
"""
Validates fallback chain for structured output role.
"""
chain = model_registry.get_fallback_chain("groq", "STRUCTURED_OUTPUT")
assert chain is not None
assert len(chain) > 0
# At least one model in chain should support JSON
json_capable = [m for m in chain if model_registry.supports(m, Capability.JSON_OBJECT)]
assert len(json_capable) > 0
@pytest.mark.asyncio
async def test_model_context_windows():
"""
Validates that models have context window definitions.
"""
# Check that at least some models have context window defined
models_with_context = [
m for m, meta in model_registry.MODELS.items()
if meta.get("context_window", 0) > 0
]
assert len(models_with_context) > 0