from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_v037_files():
    for p in ['app/api/v037.py','app/services/api_gateway_v037.py','app/static/api-gateway.html','migrations/037_api_gateway_integration_studio.sql']:
        assert (ROOT/p).exists()
def test_v037_features():
    text=(ROOT/'app/services/api_gateway_v037.py').read_text()
    for x in ['normalize_openapi','normalize_wsdl','validate_policy','generate_consumer_key','oauth2','circuit_breaker']:
        assert x in text
def test_v037_routes():
    text=(ROOT/'app/api/v037.py').read_text()
    for x in ['/apis','/apis/import','/credentials','/policies','/publish','/subscriptions','/webhooks','/audit']:
        assert x in text
def test_v037_rls():
    text=(ROOT/'migrations/037_api_gateway_integration_studio.sql').read_text()
    assert 'ROW LEVEL SECURITY' in text and 'WITH CHECK' in text and 'app.current_tenant_id' in text
