from pathlib import Path ROOT=Path(__file__).resolve().parents[1] def test_version(): assert (ROOT/"VERSION").read_text(encoding="utf-8").strip()=="4.6.15" def test_batch_url_authorization_helper_exists(): py=(ROOT/"routes"/"downloads.py").read_text(encoding="utf-8") assert "def _validated_batch_download_url" in py assert "OCEAN_BATCH_MANAGER._read(batch_job_id)" in py assert "hmac.compare_digest(expected,url)" in py def test_allowlist_is_not_globally_disabled(): py=(ROOT/"routes"/"downloads.py").read_text(encoding="utf-8") assert "if not batch_authorized and not _host_allowed" in py assert "external download host is not allowlisted and URL was not verified" in py def test_frontend_sends_batch_identity(): js=(ROOT/"static"/"js"/"app.js").read_text(encoding="utf-8") assert "batch_job_id:state.batch_job_id" in js assert "subtask_id:file.subtask_id" in js