from pathlib import Path

def test_v006_routes_present():
    text=Path('app/api/v006.py').read_text()
    for needle in ['/layout','/cross-filter','/restore/{revision_id}','/report-deliveries','/secure-downloads','/integration-flows']:
        assert needle in text

def test_report_worker_registered():
    assert 'run_report_schedules' in Path('app/workers/celery_app.py').read_text()
    assert 'execute_due_report_schedules' in Path('app/services/report_delivery.py').read_text()

def test_studio_interactions_present():
    text=Path('app/static/studio.html').read_text()
    for needle in ['enableGridInteractions','applyCrossFilter','restoreRevision','drawMap','saveLayoutNow']:
        assert needle in text

def test_integration_studio_present():
    text=Path('app/static/integration-studio.html').read_text()
    assert 'request_mapping' in text and 'transformations' in text and 'executeFlow' in text
