from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_v027_files():
    for p in ['app/api/v027.py','app/services/ai_center.py','app/static/ai-center.html','migrations/027_enterprise_ai_center.sql']:
        assert (ROOT/p).exists()
def test_v027_main_integrated():
    s=(ROOT/'app/main.py').read_text(); assert 'v027_router' in s and "version='0.38.0'" in s and "'/ai-center'" in s
def test_v027_security_contracts():
    s=(ROOT/'app/services/ai_center.py').read_text(); assert 'decrypt_secret' in s and 'SENSITIVE_PATTERNS' in s and 'requires_approval' in s
    m=(ROOT/'migrations/027_enterprise_ai_center.sql').read_text(); assert 'FORCE ROW LEVEL SECURITY' in m and 'WITH CHECK' in m
def test_v027_providers():
    s=(ROOT/'app/services/ai_center.py').read_text();
    for x in ['openai','gemini','anthropic','ollama','mock']: assert x in s
