from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_v030_files():
    for p in ['app/api/v030.py','app/services/marketplace.py','app/static/marketplace.html','app/static/partner-portal.html','migrations/030_marketplace_partner_ecosystem.sql']:
        assert (ROOT/p).exists()
def test_v030_security_contracts():
    text=(ROOT/'app/services/marketplace.py').read_text()
    assert 'validate_manifest' in text and 'package_sha256' in (ROOT/'app/models/entities.py').read_text()
    assert 'ensure_entitlements' in text and 'resolve_dependencies' in text
def test_v030_tenant_isolation():
    sql=(ROOT/'migrations/030_marketplace_partner_ecosystem.sql').read_text()
    assert 'ROW LEVEL SECURITY' in sql and 'WITH CHECK' in sql
def test_v030_routes():
    text=(ROOT/'app/api/v030.py').read_text()
    for route in ['/catalog','/assets/{asset_id}/install','/publishers','/partner/commissions']:
        assert route in text
