from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_v026_files():
    for p in ['app/api/v026.py','app/services/etl_studio.py','app/static/etl-studio.html','migrations/026_visual_etl_studio.sql']:
        assert (ROOT/p).exists()
def test_v026_routes_and_version():
    main=(ROOT/'app/main.py').read_text(); api=(ROOT/'app/api/v026.py').read_text()
    assert 'v026_router' in main and "def etl_studio" in main
    assert "/pipelines/{pipeline_id}/run" in api and '/templates' in api
def test_v026_security_and_graph():
    svc=(ROOT/'app/services/etl_studio.py').read_text(); mig=(ROOT/'migrations/026_visual_etl_studio.sql').read_text()
    assert 'ALLOWED_NODES' in svc and 'O pipeline contém ciclo' in svc
    assert 'FORCE ROW LEVEL SECURITY' in mig and 'WITH CHECK' in mig
def test_v026_transformations():
    svc=(ROOT/'app/services/etl_studio.py').read_text()
    for token in ["kind=='select'","kind=='rename'","kind=='filter'","kind=='derive'","kind=='validate'"]:
        assert token in svc
